# SICP Solutions

### Chapter 4, Metalinguistic Abstraction

#### Exercise 4.7

To understand this solution, just we need to check that make-let needs both arguments to be list. Thus the result of each iteration of fold-right must be list.

Since the fold-right returns list even in the last iteration, we just take the first element.

Example:

#### Do we need to expand explicitly?

This is more interesting part because it feels like magical that somehow every thing is working as per theory.

No, we need not to expand let explicitly. This is possible because of the way we lookup variables in environment.

It is important to understand this conceptually. Here is my understanding:

• let* creates let
• let creates lambda
• when lambda is evaluated a procedure is created. See make-procedure.
• Now after creation of procedure, we apply this procedure to its arguments.
• During application we extend the base environment and add the procedure parameters in the extended environment.
• If there is new lambda expression/procedure, same iteration is done.
• Thus every nested lambda get the required variables!

:)