jordan wrote:I was wondering if there is a way to define a function/macro that can accept arbitrary forms as arguments, without having to QUOTE said forms in the calling code. (Basically, I'm looking to replicate the behavior of many built-in functions/macros that let you say things like (foo (x y) ... ) without having to say (my-foo '(x y) ... ) ... hopefully that makes sense.)
jordan,
Only macros let you do what you want. The Lisp evaluation function (EVAL), built into the heart of the interpreter/compiler, is wired to view any list that is not quoted as a function call. It's also hard-wired to treat any symbol as a reference to a variable. QUOTE is simply the mechanism that tells EVAL that the following form is literal data and to treat it as such, not as something to be evaluated further.
The reason that macros don't do this is because they operate on the code
as data. Quite literally, a macro simply sees that "code" as a list of symbols and such. After the macro transforms the code, manipulating it however it wants, then EVAL operates on the results. At that point, as Paul pointed out, all the quoting has to be correct.
I'd caution you not to use the technique Paul showed you in much code that is going to be ready by anybody else. Other Lisp programmers will intuitively know when quoting is required and they'll be thrown off if they don't have to do it.
