This is a really good question.
I think it is nuanced but definitely accountable:
Macros do not get stuck in s-expressions. See LOOP Macro for a very complex language written using keywords (characters). So, although you can start and end the loop with parentheses, inside it has its own syntax.
Example:
(loop for x from 0 below 100 when (even x) collect x)
However, most simple macros simply use s-expressions. And you will be stuck using them.
But s-expressions, as Sergio replied, are starting to feel right. The syntax gets out of the way and you start coding in the syntax tree.
As for reader macros, yes, you could write something like this:
But you need to write your own Ruby syntax parser.
You can also mimic some of the Ruby constructs, such as blocks, with macros that compile with existing Lisp constructs.
translates to
(lambda () (some lisp (code goes here)))
For more information on how to do this, see this page .
Eric Normand Sep 15 '08 at 15:07 2008-09-15 15:07
source share