shithub: femtolisp

Download patch

ref: 28c39e8cf0f3246bb982aff540bda5309d2c9ac0
parent: 43e8d1fbf0ae895bb09b2beb89b31f1f7440a8e2
author: JeffBezanson <jeff.bezanson@gmail.com>
date: Wed Apr 1 18:23:19 EDT 2009

fixing definition of let*


--- 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)))