2010/7/8 Pedro Teixeira <pedr...@gmail.com>

>
> What's the idiomatic way to handle cases where one has a macro rather
> than a function?
>
> For example:
>
> intent is as follows but does not work:
> (def args [false true false])
> (apply or args)
>
>
> alternatives?
>
> a> (eval `(or @~args))
>

big no-no.

>
> b> (reduce #(or %1 %2) args)
>
> that's it.


>
> any recommended?
>
>
> thanks,
> Pedro
>
> On Jul 7, 4:47 pm, Laurent PETIT <laurent.pe...@gmail.com> wrote:
> > 2010/7/7 Cameron <cpuls...@gmail.com>:
> >
> > > Thanks everyone! I certainly have my solution; but, I'm still a bit
> > > confused. Here's another example...
> >
> > > user=> (defmacro foo [coll] `(map identity ~coll))
> > > #'user/foo
> > > user=> (foo (list 1 2 3))
> > > (1 2 3)
> >
> > > In this example, I pass an explicit list and all I have to do is
> > > unquote 'coll'. How is passing an explicit list any different than
> > > having it destructured via '&' in the argument vector?
> >
> > You're not passing a list. You're passing the code for creating a list.
> > Use macroexpand, it's your friend
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com<clojure%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to