Exercises in this lecture  previous -- Keyboard shortcut: 'p'  next -- Keyboard shortcut: 'n'  Go to the slide, where this exercise belongs -- Keyboard shortcut: 'u'  

Exercise 2.19
Generalization of curry-2 and curry-3 ***


On an earlier slide page we have seen how to generate curried functions with 2 and 3 parameters - curry2 and curry3. We have also seen how to generate uncurried functions from curried functions - uncurry2 and uncurry3.

Now generalize curry2 and curry3:

   (define (curry f n) ...)

where f is a function with n parameters.

Similary, generalize uncurry2 and uncurry3:

   (define (uncurry cf n) ...)

where cf is a curried function with n levels.

Test your functions appropriately, and be sure that (uncurry (curry f n) n) is equivalent with f (where f is a function of n parameters).


Solution