Pranav
Pranav

Reputation: 3312

sicp section 4.1.6

I need some help in understanding the material in SICP's section 4.1.6 on Internal definitions.

I understand the problem raised when mutually recursive functions are defined. But i dont understand how it is solved by transforming the following lambda expression

(lambda <vars >
  (define u <e1 >)
  (define v <e2 >)
  <e3 >)

into:

(lambda <vars >
  (let ((u ’*unassigned*)
        (v ’*unassigned*))
    (set! u <e1 >)
    (set! v <e2 >)
    <e3 >))

Can someone help me out here? Thanks.

Upvotes: 1

Views: 169

Answers (1)

Alex Martelli
Alex Martelli

Reputation: 881555

If <e1> tries referring to v in the first form, it fails -- v is not defined (not yet, but the not part is the important one). But in the second form, v is defined by the time you get to <e1> (though not yet assigned -- but that's ok!-).

Upvotes: 3

Related Questions