Testing with syntax-rules macro

This commit is contained in:
Justin Ethier 2017-12-08 19:50:44 -05:00
parent b96813bb68
commit 1903a87cb9

View file

@ -1,5 +1,22 @@
(import (scheme base) (scheme write))
(define-syntax my-let
(syntax-rules
()
((my-let ((name val) ...) body1 body2 ...)
((lambda (name ...) body1 body2 ...) val ...))
((my-let tag ((name val) ...) body1 body2 ...)
((letrec ((tag (lambda (name ...) body1 body2 ...)))
tag)
val ...))))
(write
(my-let ((x 'outer))
(let-syntax ((m (syntax-rules () ((m) x))))
(my-let ((x 'inner))
(m)))) ;; Should be outer
)
;; (let-syntax ((given-that (syntax-rules ()
;; ((given-that test stmt1 stmt2 ...)
;; (if test