If I have: (apply f '(x1 x2 x3 .... xn)) and I'd like to change it to a macro expansion
I have (apply f '(x1 x2 x3 .... xn))
, and I'd like to change it to a ma开发者_如何学Ccro expansion: (f x1 x2 x3...xn)
. What kind of problems can occur?
If you're just converting
(define (my-apply f args)
(apply f args))
to
(define-macro (my-other-apply f args)
`(,f ,@args))
then it seems to be simple enough. The biggest pitfall in this situation is that you'd have to remember not to quote the list you pass to the macro.
>(my-apply + '(1 2 3))
>6
>(my-other-apply + '(1 2 3))
>ERROR syntax-error: "(+ quote 1 2 3)"
>(my-other-apply + (1 2 3))
>6
精彩评论