Tutorial by Examples

Prolog doesn't have iteration, but all iteration can be rewritten using recursion. Recursion appears when a predicate contains a goal that refers to itself. When writing such predicates in Prolog, a standard recursive pattern always has at least two parts: Base (non-recursive) clause: Typically...
Member member/2 has signature member(?Elem, ?List) and denotes true if Elem is a member of List. This predicate can be used to access variables in a list, where different solutions are retrieved through backtracking. Example queries: ?- member(X, [1,2,3]). X = 1 ; X = 2 ; X = 3. ?- member(X...

Page 1 of 1