October 2, 1995
Due in quiz sections October 17, 1995
twice that takes a
list of atoms (which may be empty), and returns a new list of the same
length, where each element in the new list is a list of length two, with
the original element repeated. Examples:
twice, which should use one of
the applicative operators instead. This version should not be recursive.
twice
function, called flat-twice, that takes a
list of atoms (which may be empty), and returns a new list with each atom
repeated. You can use either recursion or applicative programming (but no
side effects). Examples:
boolean-eval that takes a
list, which should be a boolean expression, and returns its value.
Don't use the built-in function eval in writing
boolean-eval (which would result in a one-line solution!) --
the idea is to write your own evaluation function for booleans. Hint: this
function should be multiple recursive. We can define a boolean expression
as one of the following:
t
nil
(and <boolean-expression>
<boolean-expression>)
(or <boolean-expression>
<boolean-expression>)
(not <boolean-expression>)