Department of Computer Science, CSUDH
CSC 321: Programming Languages
CSC521: Advanced Programming Languages
(Spring 2007)
Writing Assignment 9
Chapter 15: Logic Programming
Due May 8, 2007
All questions are scored the same.
Closed-world assumption in Prolog
Horn clause in Prolog
Unification in Prolog
Backtracking in Prolog
Cuts in Prolog
Prolog search tree (and-or tree)
member(M, [M|_]).
member(M, [_|T]) :- member(M, T).
Draw Prolog search trees for the following queries:
i. ?- member(b, [a, b, c]).
ii. ?-X = [1, 2, 3], member(a, x).
iii. ?-Member(a, x), x = [1, 2, 3].
- Remove all duplicates of elements in a list.
- Reverse the sequence of elements in a list.