Prolog cheat sheet
Prolog predefined stuff |
Useful custom functions |
| = - unification \= - true if unification fails == - identity \== - identity predicate negation =:= - arithmetic equality predicate =\= - arithmetic equality negation |
member(X,List) conc(L1,L2,List) add(X,L,L1) del(X,L,L1) insert(X,L,L1) sublist(S,L) permutation(X,L) oddLength(L) evenLength(L) reverse(List,ReversedList) maxList(List,Max) ordered(List) subsum(Set,Sum,Subset) |
| X<Y X>Y X>=Y X<=Y |
|
custom operator:-op(precedense,xfy,name). |
|
cut !true, fail%(P,!,fail;true). |
|
| var(x) nonvar(X) atom(X) integer(X) atomic(X) |
|
| assert(C) retract(C) asserta(C) - at the beginning assertz(C) - at the end |
|
| bagof(X,P,L) setof(X,P,L) findall(X,P,L) length(L,N) |
|
| _X -> private variable |
Related Articles
| Next > |
|---|