Another example of list processing


next up previous contents
Next: Uses of lists
Up: Introduction to Prolog for Mathematicians
Previous: Example of list processing

Another example of list processing

append( [], L, L ).

append( [H|T], L, [H|T1] ) :-
    append( T, L, T1 ).

Read this as:

The result of joining the empty list
to L is L.

The result of joining the list whose
head is H and whose tail is T to
L is a list whose head is H and whose
tail is T1 if
    the result of joining T to L is T1.



Jocelyn Paine
Mon Jul 17 22:27:41 BST 1995