The combination of the list data structure and the ability to define recursive rules allows you to create several highly reusable algorithms. All the Logikus programs in this chapter are included in this book's CD in .txt files. You can open these files with any editor and copy and paste them into your own programs.
The member program is probably the most fundamental and most reused algorithm in logic programming. The program (from file member.txt) is
member(X, [X | Rest]); member(X, [Y | Rest]) :- member(X, Rest);
Figure 13.7 shows this program in use.
A high-level ...