fixing definition of let*

This commit is contained in:
JeffBezanson 2009-04-01 22:23:19 +00:00
parent 43e8d1fbf0
commit 28c39e8cf0
1 changed files with 6 additions and 1 deletions

View File

@ -347,12 +347,17 @@
(list 'quote v))) (list 'quote v)))
(define-macro (let* binds . body) (define-macro (let* binds . body)
(if (atom? binds) (f-body body)
`((lambda (,(caar binds))
(let* ,(cdr binds) ,@body))
,(cadar binds))))
(define-macro (letrec binds . body)
(cons (list 'lambda (map car binds) (cons (list 'lambda (map car binds)
(f-body (f-body
(nconc (map (lambda (b) (cons 'set! b)) binds) (nconc (map (lambda (b) (cons 'set! b)) binds)
body))) body)))
(map (lambda (x) #f) binds))) (map (lambda (x) #f) binds)))
(set-syntax! 'letrec (symbol-syntax 'let*))
(define-macro (when c . body) (list 'if c (f-body body) #f)) (define-macro (when c . body) (list 'if c (f-body body) #f))
(define-macro (unless c . body) (list 'if c #f (f-body body))) (define-macro (unless c . body) (list 'if c #f (f-body body)))