From 28c39e8cf0f3246bb982aff540bda5309d2c9ac0 Mon Sep 17 00:00:00 2001 From: JeffBezanson Date: Wed, 1 Apr 2009 22:23:19 +0000 Subject: [PATCH] fixing definition of let* --- femtolisp/system.lsp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/femtolisp/system.lsp b/femtolisp/system.lsp index 0ebf434..bee5b68 100644 --- a/femtolisp/system.lsp +++ b/femtolisp/system.lsp @@ -347,12 +347,17 @@ (list 'quote v))) (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) (f-body (nconc (map (lambda (b) (cons 'set! b)) binds) body))) (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 (unless c . body) (list 'if c #f (f-body body)))