2010/7/8 Pedro Teixeira <[email protected]> > > 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 <[email protected]> wrote: > > 2010/7/7 Cameron <[email protected]>: > > > > > 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 [email protected] > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > [email protected]<clojure%[email protected]> > 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 [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
