CS212 Exams
Spring 1999 - Prelim 2

Encoding Special Forms


Consider the following expression:

(letrec ((fact (lambda (n)
                   (if (<= n 1)
                       1
                       (* n (fact (- n 1)))))))
    fact)
The expression defines a local, recursive version of the factorial function and returns the function as its value. Write an equivalent expression using let and set! but without using define or letrec.

Solution

Return to CS 212 Prelim 2 - Spring 1999