News for hackers. Stuff that matters.
Re:How Lisp macros differ from static code-generation and me... by mahmud on Wednesday January 26, 2011 @12:10PM (#2143928)
By the way, don't confuse macros with backquote; the backquote facility is probably closer to C's preprocessors. I haven't heard this claim before, and I might not be entirely right, but it's what provides for the "fill in the blanks" type symbolic computing.

For example:

  (defun sum (x y)
    `(,x + ,y = ,(+ x y)))
This is a SUM function which looks like this when run:

  (sum 4 5) ==> (4 + 5 = 9)
The backquote (`) says the following form and its sub-forms (if any) are all quoted. But you can poke holes in the quote and fill in with the value of outside variables, using comma (,). So in the example, everything is quoted in the body of sum, except three things: x, y, and (+ x y). Each of those is then evaluated yielding 4, 5 and 9, then, finally, the template is filled in (4 + 5 = 9).

If you want to confirm this, you can change the + and = to any other symbol and it would still display. E.g:

  (defun sum (x y)
    `(,x frob ,y != ,(+ x y)))

  (sum 4 5) ==> (4 FROB 5 != 9)
Re:How Lisp macros differ from static code-generation and me... by sedachv on Wednesday January 26, 2011 @03:34PM (#2145013)
Don't forget that `, (backquote-comma) can also be adapted for pattern matching/destructuring (http://www.cliki.net/fare-matcher does this).

I think combining backquote-comma's s-exp-making and s-exp-destructuring powers is a viable way to abstract s-exps from their representations as linked lists/arrays/whatever sequence you want to use.

Re:How Lisp macros differ from static code-generation and me... by wingo on Wednesday January 26, 2011 @05:18PM (#2145456)
I like Conrad Barski's take on explaining quasiquote:

http://www.lisperati.com/looking.html

"Flip, flop, flip, flop..."

Re:How Lisp macros differ from static code-generation and me... by arethuza on Wednesday January 26, 2011 @12:32PM (#2144013)
You can also splice values into backquoted expressions using ,@foo rather than ,foo - which I seem to remember being rather useful.
Re:How Lisp macros differ from static code-generation and me... by zck on Wednesday January 26, 2011 @02:27PM (#2144655)
It's incredibly useful. The actual definition of until from Arc:

  (mac until (test . body)
    `(while (no ,test) ,@body))
It's really useful for bodies of code like this.