October 2, 1995
Due in quiz sections October 10, 1995
+,
first, rest, cons,
length, equal, and not. You don't
have to hand in anything for this question.
(cons 1 (cons 2 nil))
(list 1 2)
(cons (cons 'x nil) (cons 'x nil))
number-stuff that takes a
single floating-point argument n and returns a list consisting of n, n
squared, n cubed, and the square root of n. Example:
(number-stuff 3.0) evaluates to
(3.0 9.0 27.0 1.7320508)
You don't need to worry about checking for non-numeric or negative arguments.
next-color
that takes a symbol (one of green, yellow, or red) representing a stoplight
color, and returns the next color in the light's sequence. If the argument
isn't one of these symbols return the atom huh.
Examples:
(next-color 'green) evaluates to yellow
(next-color 'yellow) evaluates to red
(next-color 'red) evaluates to green
(next-color (next-color 'green)) evaluates to red
(next-color 'purple) evaluates to huh