This is an old revision of the document!
sister(X,Y)
⇔ X
is a sister of Y
.
X \== Y
, ali pa je postavljen na napačno mesto (preden sta X
in Y
instancirana).female(Y)
namesto female(X)
, ali pa oba hkrati (relacija ni simetrična).
connected(X, Y, N)
⇔ X
and Y
are connected with a series of (no more than N
) parent/child relations.
(parent(X,Z) ; parent(Z,X))
. Nekaj nepravilnih verzij:parent(X,Z) , parent(Z,X)
: oboje hkrati ne more veljati.parent(X,Z) ; parent(Y,Z)
: ne najde povezave med X
in Y
, če je kateri brez otrok.N is N-1
: N
ne more biti hkrati npr. 3 in 2.
conc(L1, L2, L)
⇔ the list L
is obtained by appending the elements of L2
to L1
.
H
v izhodnem seznamu doda v rekurzivnem cilju, namesto v glavi pravila:conc([H|T], L2, L) :- conc(T, L2, [H|L]).
del(X, L1, L2)
⇔ the list L2
is obtained from L1
by deleting element X
.
del(X, [X|T], T)
– in ne iz seznama z enim elementom – del(X, [X], [])
.del(X,[H|T],NewT):-
namesto del(X,[H|T],[H|NewT]):-
.
insert(X, L1, L2)
⇔ the list L2
is obtained from L1
by inserting the element X
at arbitrary position.
insert(X, L, [X|L])
– in ne v prazen seznam – insert(X, [], [X])
.
min(L, Min)
⇔ Min
is the smallest element in the list L
.
(MinT < H, Min = MinT ; MinT >= H, Min = H)
. Napake:[1,1]
.
count(X, L, N)
⇔ N
is the number of times the element X
appears in the list L
.
X
ni enak prvemu elementu seznama L = [H|T]
.