Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add let*

  • Loading branch information...
commit 7aa531d4862ca29d3ede8a6780d08d25292dc111 1 parent cdf3c01
@cpylua authored
Showing with 15 additions and 0 deletions.
  1. +9 −0 lib/core.scm
  2. +6 −0 test/let-test.scm
View
9 lib/core.scm
@@ -543,3 +543,12 @@
(define (force promise)
(promise))
+; let*
+(define-macro let*
+ (lambda (bindings . body)
+ (cond
+ ((null? (cdr bindings))
+ `(let ,bindings ,@body))
+ (else
+ `(let ,(list (car bindings)) (let* ,(cdr bindings) ,@body))))))
+
View
6 test/let-test.scm
@@ -0,0 +1,6 @@
+(let* ((x 7)
+ (y (+ x 1))
+ (z (* x y)))
+ (display-line x)
+ (display-line y)
+ (display-line z))
Please sign in to comment.
Something went wrong with that request. Please try again.