3 (provide let->combination)
5 (define (tagged-list? exp tag)
11 (define (make-lambda params body)
12 (cons 'lambda (cons params body)))
15 (tagged-list? expr 'let))
17 (define (let-bindings expr) (cadr expr))
18 (define (let-bindings-variables bindings) (map car bindings))
19 (define (let-bindings-values bindings) (map cadr bindings))
20 (define (let-body expr) (cddr expr))
22 (define (let->combination expr)
23 (let ([bindings (let-bindings expr)])
24 (let ([vars (let-bindings-variables bindings)]
25 [vals (let-bindings-values bindings)]
26 [body (let-body expr)])
27 (cons (make-lambda vars body) vals))))
29 (define ns (make-base-namespace))
30 (eval (let->combination '(let ((x 2) (y 3)) (+ x y))) ns)