|
|
|
|
30 Points Due: 2/24/00 at the start of class
Complete each of the following problems:
- Consider the following Prolog code, taken from an on-line
tutorial linked from the class home page:
takeout(X, [X|R], R).
takeout(X, [F|R], [F|S]) :- takeout(X, R, S).
- Describe what this predicate does.
- Write a Scheme implementation of
takeout 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?
- Write a Scheme implementation of
takeout_all that
removes every instance of its first parameter at the top level
of its second parameter, which is a list.
- Write a Prolog implementation of
takeout_all .
|