Binding constructs for syntactic keywords
The
(let-syntax
{bindings} {body}
)
syntax
Syntax:
Bindings has the form
(({keyword} {transformer spec}) ...)
Each keyword is an identifier,
each transformer spec is an instance of
Semantics:
The body is expanded in the syntactic environment
obtained by extending the syntactic environment of the
(let-syntax ((given-that (syntax-rules ()
((given-that test stmt1 stmt2 ...)
(if test
(begin stmt1
stmt2 ...))))))
(let ((if #t))
(given-that if (set! if 'now))
if)) ==> now
(let ((x 'outer))
(let-syntax ((m (syntax-rules () ((m) x))))
(let ((x 'inner))
(m)))) ==> outer
(letrec-syntax
{bindings} {body}
)
syntax
Syntax:
Same as for let-syntax .
Semantics:
The body is expanded in the syntactic environment obtained by
extending the syntactic environment of the
(letrec-syntax
((my-or (syntax-rules ()
((my-or) #f)
((my-or e) e)
((my-or e1 e2 ...)
(let ((temp e1))
(if temp
temp
(my-or e2 ...)))))))
(let ((x #f)
(y 7)
(temp 8)
(let odd?)
(if even?))
(my-or x
(let temp)
(if y)
y))) ==> 7
|