From 29739bc7310b9a52c50fc5f67b5d09f065ce1031 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Tue, 12 Dec 2017 10:37:04 -0500 Subject: [PATCH] More examples --- tests/let-syntax.scm | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/let-syntax.scm b/tests/let-syntax.scm index 91d0c13b..e9ec041c 100644 --- a/tests/let-syntax.scm +++ b/tests/let-syntax.scm @@ -33,6 +33,40 @@ (define internal-def 'ok)) internal-def) +;; From Husk: +;; +; Examples from the source to R5RS pitfall 3.3 +;; (assert/equal +;; (let ((a 1)) +;; (letrec-syntax +;; ((foo (syntax-rules () +;; ((_ b) +;; (bar a b)))) +;; (bar (syntax-rules () +;; ((_ c d) +;; (cons c (let ((c 3)) +;; (list d c 'c))))))) +;; (let ((a 2)) +;; (foo a)))) +;; '(1 2 3 a)) +;; +;; ; Examples from/based on pitfall 8.3 (assert/equal 1 +;; (let ((x 1)) +;; (let-syntax ((foo (syntax-rules () ((_) 2)))) +;; (define x (foo)) +;; 3) +;; x)) +;; (assert/equal 1 +;; (let ((x 1)) +;; (letrec-syntax ((foo (syntax-rules () ((_) 2)))) (define x (foo)) +;; 3) +;; x)) +;; +;; ; Issue #151 - Preserve hygiene across syntax-rules and ER macros +;; (assert/equal +;; (let ((unquote 'foo)) `(,'bar)) +;; '(,'bar)) + #;(let ((a 1)) (let-syntax