Reputation: 233
I would like a macro that can take any number of arguments and return a list of each argument, like this:
(TEST first second third)
=> '(first second third)
Upvotes: 2
Views: 651
Reputation: 236004
Here's another way, using define-syntax
:
(define-syntax TEST
(syntax-rules ()
((_ . lst) 'lst)))
Of course you can quote the expression directly, it really isn't necessary to use a macro here:
'(first second third)
Upvotes: 4
Reputation: 18917
Like so?
(define-syntax-rule (TEST . lst)
(quote lst))
(TEST first second third)
=> '(first second third)
or simply
(define-syntax-rule (TEST . lst)
'lst)
Upvotes: 5