views:

78

answers:

1

If I have: (apply f '(x1 x2 x3 .... xn)) and I'd like to change it to a Macro expansion: (f x1 x2 x3...xn), what kind of problems can occur?

+2  A: 

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
Inaimathi