|
|
|
|
30 Points Due: 2/21/01 at the start of class
Complete each of the following problems:
- Chapter 15, Problem 6 (p. 639). You may not use the predefined
union predicate in your solution. If you are testing
your answer out using a Prolog interpreter, call your predicate
my_union so that it is not confused with the builtin
version.
- Write and test a Prolog implementation of the predicate
prefix(A, B) that tests to see if the list A
is a valid prefix of the list B :
?- prefix([1,2,3],[1,2,3,4,5]).
yes
?- prefix([1,2],[1,a,2,3]).
No
- Write a Scheme implementation of
prefix that behaves
as closely as possible to this Prolog predicate. In what way(s),
if any, is the behavior of your Scheme code
different from the behavior of the Prolog code?
|