identifier-syntax[syntax] identifier-syntax tmpl
[syntax] identifier-syntax (id1 tmpl1) ((set! id2 e2) tmpl2)
R6RS, ChezScheme
From R6RS examples:
define p (cons 4 5))
(define-syntax p.car (identifier-syntax (car p)))
p.car => 4
(set! p.car 15) => &syntax exception
(define p (cons 4 5))
(define-syntax p.car
(identifier-syntax
(_ (car p))
((set! _ e) (set-car! p e))))
(set! p.car 15)
p.car => 15
p => (15 5)
See also syntax-rules, syntax-case
|