From 7575297b49c6d06e524b9dff038083a863720b53 Mon Sep 17 00:00:00 2001 From: Tim Vaughan Date: Wed, 31 May 2017 21:39:52 +1200 Subject: [PATCH] Implemented let* --- src/scheme-library.scm | 8 ++++++++ src/scheme.4th | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/scheme-library.scm b/src/scheme-library.scm index 2c6146e..a420c70 100644 --- a/src/scheme-library.scm +++ b/src/scheme-library.scm @@ -253,6 +253,14 @@ `((lambda ,(map (lambda (x) (car x)) args) ,@body) ,@(map (lambda (x) (cadr x)) args))) +; let* + +(define-macro (let* args . body) + (if (null? args) + `(let () ,@body) + `(let (,(car args)) + (let* ,(cdr args) ,@body)))) + ; while (define-macro (while condition . body) diff --git a/src/scheme.4th b/src/scheme.4th index 6e2c492..d0bca19 100644 --- a/src/scheme.4th +++ b/src/scheme.4th @@ -1652,7 +1652,7 @@ hide env R> drop ['] eval goto-deferred \ Tail call optimization endof - except-message: ." object not applicable." recoverable-exception throw + except-message: ." object '" drop print ." ' not applicable." recoverable-exception throw endcase ; -- 2.20.1