back

by wsxiaoys·14y ago·view on hn ↗
> You can't return one from a function, for instance.

Actually you can, for example:

    (assign macro-maker 
      (fn (x)
        (annotate 'mac (fn (y) `(cons ,x ',y)))))

    (assign m1 (macro-maker 1))

    (disp (m1 a)) ; print (1 . a)

    (macex '(m1 3)) ; print (cons 1 (quote a))
Above code are tested in tryarc.org.

> Non-first-class macros are the way to go for efficiency, at least, and first-class macros themselves are fairly useless.

It's true that non-first-class macros can be more efficiency. But first class macros can benefit from it's nature - a lexical function with environment. Construct such macros can be fancy.