CMSC
471/671 Artificial Intelligence
Fall 2000
Section
0101 TuTh
5:30 - 6:45pm MP103
Due Sept. 19, 2000
1.
Which
of the following S-expressions are atoms? Which of them are lists?
A, “this is foo”, (), T, (1 2 3), 25, (sqrt 36),
NIL
(You may use CLISP to verify you answers if you are not sure.)
2.
What
will be returned when evaluating each of the following S-expressions?
a)
(mapcar
#’= L1 (reverse L1)), where L1 has been assigned value (1 2 3)
b)
(set
y x), where x has been assigned value 5 but y has not
c)
(nth
1 ‘(a b c))
3.
Using
recursive definition to define a LISP function
(union L1 L2)
that returns the union of two sets represented as lists L1 and L2. Both L1 and L2 can be empty sets.
4.
Write
a function
(average L)
that iteratively computes the average of a list of real numbers in list L. You may assume that L is non-empty.