This problem requires Lecture 4 and Lecture 5.
Part A involves writing your first function that is autograded. Make sure it is not commented out. Parts B and C should be in block comments.
Part A
Write the following variable arity functions to handle either 2 or 3 arguments.
If you use built-in functions (like +), you may only pass them 2 arguments
at a time. Hint: try using if and/or cond.
> (sum 1 2) 3 > (sum 3 4 5)
Notice: Uninitialized string offset: 2 in /users/home2/ta/cs330ta/public_html/cs330/inc/codeformat.php on line 115
12
> (even-parity 1 0) #f > (even-parity 1 0 1) #t
YOU MUST NAME YOUR FUNCTIONS sum AND
even-parity
Part B
Translate the following let expression into the equivalent application of
a lambda expression to operands:
(let ((a 3)
(b (+ 2 3)))
(+ a b))Type both this let expression and your equivalent expression using
lambda into the interpreter to verify that they work the same way.
Part C
Most languages have features that are just syntactic sugar. Pick a language
you like to work with (C++, Java, etc.) and name as many features that you can
think of that are syntactic sugar. What other features in the language are they equivalent to?
Instructions on submitting homework is here
Last updated at 9:16 pm on Friday, September 03, 2004.