mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-16 09:17:35 +02:00
Testing with syntax-rules macro
This commit is contained in:
parent
b96813bb68
commit
1903a87cb9
1 changed files with 17 additions and 0 deletions
|
@ -1,5 +1,22 @@
|
||||||
(import (scheme base) (scheme write))
|
(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 ()
|
;; (let-syntax ((given-that (syntax-rules ()
|
||||||
;; ((given-that test stmt1 stmt2 ...)
|
;; ((given-that test stmt1 stmt2 ...)
|
||||||
;; (if test
|
;; (if test
|
||||||
|
|
Loading…
Add table
Reference in a new issue