On Nov 8, 2008, at 5:55 AM, Phlex wrote:
> Hello, > > I was missing the prog1 macro from common lisp, so here it is. > > (defmacro prog1 [& body] > " (prog1 forms*) > Evaluates all the forms, returning the result of the first form" > `(let [result# ~(first body)] > ~@(rest body) > result#)) > > user> (prog1 "a" "b" "c") > "a" > user> (prog1) > nil > user> (prog1 "a") > "a" > > Might be usefull to have this in the language. Maybe it's already > there > but couldn't find it ! I came across a place where it would be useful as well, but worked around it manually. "do1" would arguably fit better into Clojure's naming scheme. I think none of "prog1", "prog2", or a hypothetical "do1" have names that really jump out at a beginner with what they mean (though of course, one isn't a beginner forever). A collection of some useful CL macros written in Clojure would probably make a nice addition to the wiki. --Steve --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
