From 306dbd470a28bcd9e850dadf2f4cdc4cd3b1633d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Nieper-Wi=C3=9Fkirchen?= Date: Thu, 22 Oct 2020 15:13:04 +0200 Subject: [PATCH 1/2] Fix and-let* so that it allows bodies according to SRFI 2. --- lib/srfi/2.sld | 4 +++- lib/srfi/2/test.sld | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/srfi/2.sld b/lib/srfi/2.sld index d046f99b..d81d9e61 100644 --- a/lib/srfi/2.sld +++ b/lib/srfi/2.sld @@ -5,8 +5,10 @@ (begin (define-syntax and-let* (syntax-rules () + ((and-let* ()) + #t) ((and-let* () . body) - (begin #t . body)) + (let* () . body)) ((and-let* ((var expr))) expr) ((and-let* ((expr))) diff --git a/lib/srfi/2/test.sld b/lib/srfi/2/test.sld index e61cb199..6cc24775 100644 --- a/lib/srfi/2/test.sld +++ b/lib/srfi/2/test.sld @@ -42,4 +42,6 @@ (let ((x #f)) (and-let* (x (y (- x 1)) ((positive? y))) (/ x y)))) (test 3/2 (let ((x 3)) (and-let* (x (y (- x 1)) ((positive? y))) (/ x y)))) + (test 5 (and-let* () (define x 5) x)) + (test 6 (and-let* ((x 6)) (define y x) y)) (test-end)))) From 0597ea68a575be6fc5e2f0539fef90c626fe350c Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Wed, 25 Nov 2020 14:39:49 +0900 Subject: [PATCH 2/2] save a char and a beta reduction --- lib/srfi/2.sld | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/srfi/2.sld b/lib/srfi/2.sld index d81d9e61..20f9aa34 100644 --- a/lib/srfi/2.sld +++ b/lib/srfi/2.sld @@ -8,7 +8,7 @@ ((and-let* ()) #t) ((and-let* () . body) - (let* () . body)) + (let () . body)) ((and-let* ((var expr))) expr) ((and-let* ((expr)))