Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to express let* as a lambda expression (not the regular let)

I have a scheme related question, how can we implement let* as a lambda expression. To be more precise, I am not wondering about the "regular" let, but the let with * which lets us use one let expression within another.

like image 425
Arash Saidi Avatar asked May 22 '13 17:05

Arash Saidi


1 Answers

The let* form is a series of nested lambdas. For example, this:

(let* ((a 10)
       (b (+ 10 a)))
  (+ a b))

Is equivalent to this:

((lambda (a)
   ((lambda (b)
      (+ a b))
    (+ 10 a)))
 10)
like image 114
Óscar López Avatar answered Nov 15 '22 09:11

Óscar López