Hi guys. I'm in the process of learning Clojure and loving it so far.
I've been dabbling in Common Lisp for years, but Clojure has so many
nice features that it's rapidly becoming my language of choice.
Recently, I've been trying to get my head wrapped around macros and
that an `or macro' would be a good candidate since you want to defer
evaluation of arguments until absolutely necessary. I hacked this up,
and it seems to work, but I wanted to see if I could have done
anything better.

(defmacro my-or [& args]
   (let [head (first args)
          tail (rest  args)]
          (if (nil? tail)
              head
              `(if ~head
                   ~head
                   (my-or ~...@tail)))))

Thanks,
Travis

--~--~---------~--~----~------------~-------~--~----~
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
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