Cool thanks! On Sunday, December 9, 2012 11:52:32 AM UTC+1, Alex Baranosky wrote: > > The version I just posted also has the benefit that it does not cause > multiple evaluations of its branches. > > On Sun, Dec 9, 2012 at 2:39 AM, Herwig Hochleitner > <[email protected]<javascript:> > > wrote: > >> 2012/12/9 Ben Wolfson <[email protected] <javascript:>> >> >>> You may want to use some delays to prevent evaluation of untaken >>> branches: >>> >> >> Right, the macro evaluates its branches before deciding. You could fix >> that: >> >> (defmacro iff >> [test & body] >> (let [args (apply hash-map body)] >> `(if ~test ~(:then args) ~(:else args)))) >> >> Notice the unquotes ~ are outside of selecting the branches. >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to [email protected]<javascript:> >> 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] <javascript:> >> 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
