扩展宏时是否可以使用用户定义的功能?
Is it possible to use user defined fuctions when expanding macro?
来自吃鸡方案手册:
define-syntax evaluates the procedure in a distinct expansion environment (initially having access to the exported identifiers of the scheme module)
是否可以将用户函数注入扩展环境?
(define-syntax my-macro
(er-macro-transformer
(lambda (exp rename compare)
(user-function exp)))
是的。使用 begin-for-syntax
或 require-extension-for-syntax
(最后一个也称为 use-for-syntax
。
来自吃鸡方案手册:
define-syntax evaluates the procedure in a distinct expansion environment (initially having access to the exported identifiers of the scheme module)
是否可以将用户函数注入扩展环境?
(define-syntax my-macro
(er-macro-transformer
(lambda (exp rename compare)
(user-function exp)))
是的。使用 begin-for-syntax
或 require-extension-for-syntax
(最后一个也称为 use-for-syntax
。