3460:430/530 Theory of
Programming Languages Summer
2004
Dr. C.-C. Chan Due: 6/21/04
Project #3 (20 pts)
Problem: Write the following lisp
functions
- Write
a lisp function mySort that takes a list of integers and returns a
sorted list in ascending order.
- Write
a lisp function set-union that returns the union of two simple list
parameters that represent sets.
The use of built-in set union function is not allowed.
- Write
a lisp function sumset that takes a positive integer N and a list
of positive integers L, determine if there is any set of elements in L
whose sum is N. If there is,
return a list of those elements; if not, return nil. For example,
(sumset
21 '(5 7 12 3 8)) returns
nil
(sumset 20 '(5 7
12 3 8)) could return (5 12
3), (5 7 8), or (12 8)
- Write
a lisp function delete-all that takes two parameters, an atom and a
list, that returns the list with all occurrences, no matter how deep, of
the given atom deleted.
- Write
a lisp predicate function equal-struct that tests for the structural
equality of two given lists. Two
lists are structurally equal if they have the same list structure,
although their atoms may be different.
Note:
Submissions:
1. Name your source files as
"p3.lisp".
2. Send
the source file by e-mail to chan@cs.uakron.edu
3. The project is due by midnight of the due
day.