拍微距我希望能够写:的扩大代码
(nota E2 82)
代替:
(define E2
(network()
[sunet <= sine-wave 82]
[out = (+ sunet)]))
我知道我能做到这一点使用宏,并试图写:
(define-syntax (nota stx)
(syntax-case stx()
[(nota x) #'(network()
[sunet <= sine-wave x]
[out = (+ sunet)])]))
但我得到这个错误:
nota: bad syntax in: (nota E2 82)
你忘了'define'吗? – stchang
你得到“坏语法”错误的原因是因为'(nota x)'表示你的宏只需要一个“参数”,但你已经给了它两个。正如@stchang提到的,它看起来像你想添加一个额外的参数,并在扩展中包含'define'。 –