Created
April 12, 2013 01:58
-
-
Save yao2030/5368707 to your computer and use it in GitHub Desktop.
SICP Exercise 4.7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (let*->nested-lets clauses) | |
(if (null? (car clauses)) | |
(cadr clauses) | |
(list 'let (list (caar clauses)) | |
(let*->nested-lets (cons (cdar clauses) | |
(cdr clauses)))))) | |
1 ]=> (let*->nested-lets '(((x 3) (y (+ x 2)) (z (+ x y 5))) (* x z))) | |
;Value 18: (let ((x 3)) (let ((y (+ x 2))) (let ((z (+ x y 5))) (* x z)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment