[prog] prolog

Marco Linux breakthru at inwind.it
Wed Dec 14 06:04:27 EST 2005


Alle 21:21, lunedì 12 dicembre 2005, Aslı ha scritto:
Hi!
I don't know what the "Linear Peg Solitaire problem" is, but i liked prolog a 
lot.
So i can tell you something about lists!
a list in prolog is made of a head and a tail.
written as [Head|Tail] or shorter [X|XS]
to check if something is a list:
is_a_list([]).
is_a_list([X|XS]) :- is_a_list(XS).

another notation for prolog lists is .(X,XS)
some example lists...
[1,2,3]
[1|[2|[3|[]]]]
.(1, .(2, .(3,[])))

Happy prolog :)

Marco.


More information about the Programming mailing list