kedu arasof
I don't know why you should go for macro here, an ordinary function can do
it.
Emeka
On Tue, Jun 23, 2009 at 12:24 AM, arasoft wrote:
>
> I just wrote my first practice macro, first without and then with
> syntax quoting:
>
> (defmacro take-until1 [function sq]
> (list 'take-while
Another advantage to the second form is that it doesn't collide with
any versions of x you may have defined
;This will do weird stuff to x
(let [x 2] (take-until1 (do-stuff-to-x)))
;This will behave like you expect
(let [x 2] (take-until2 (do-stuff-to-x)))
Meikel wrote a good set of guidelines
macro #2 is the idiomatic way of writing a macro. You generally
shouldn't worry about the expanded form of the macro.
All that extra clojure.core/ stuff is actually for your benefit.
Imagine if you use that macro in a different namespace where take-
while has been redefined. You probably intende
On Jun 22, 8:24 pm, arasoft wrote:
> I just wrote my first practice macro, first without and then with
> syntax quoting:
>
> (defmacro take-until1 [function sq]
> (list 'take-while (list 'fn (vector 'x) (list 'not (list function
> 'x))) sq))
>
> (defmacro take-until2 [function sq]
> `(take-wh