CS 224 Lab 4 - Prolog
For the query
there are two possible values of the variable X which make this query true. Prolog will print the first that it finds. If you then type a semicolon , prolog will look for another possible value for X. Type a semicolon once more and prolog will search for another answer and this time fails.
Note: Variables in prolog are always capitalized and constants are always lower case.
Write a relation membst which determines whether a value K is a member of a binary search tree.
Test your relation with the following queries:
Write a relation which may be used to find the last item in a list.
Section 19.10 in the text describes "What Prolog is Good For" with an example of a little puzzle. Read this section and copy the file manwolf.pl from ~jillz/cs224 and complete exercise 21 on p412