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 > <hhochl...@gmail.com<javascript:> > > wrote: > >> 2012/12/9 Ben Wolfson <wol...@gmail.com <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 clo...@googlegroups.com<javascript:> >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+u...@googlegroups.com <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 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