Whereas in other programming languages you decide what procedure will be used to achieve binding in prolog depth-first search is the only procedure. Lists Lists are a built in part of the prolog language. What is an example of the syntax of a list of lists. 2.and there exists a terminal condition. 2.the product of N times the factorial of N-1, for any positive integer number.
Recursion is very useful, simple and generates compact programs.
But terminal conditions must exist and be reached or it easily goes out of control. This works fine if reversing the symbols is proven true, but otherwise this results in an infinite loop. Recursion over data structures Recursion is often used in operations over data structures. Since a list is a set of elements, there are some basic operations such as intersection, difference, union, etc which we can implement in Prolog. If it is false, then the second line removes the first element of the list and attempts to unify the member predicate again with the sublist.