bah! good catch. (let [[_ year month day]] (re-find date-regex line)) fixed!
On Thu, Jan 13, 2011 at 9:03 PM, Ken Wesson <kwess...@gmail.com> wrote: > On Thu, Jan 13, 2011 at 9:54 PM, Alex Baranosky > <alexander.barano...@gmail.com> wrote: >> I see. So I may have to use some kind of clunky syntax instead of a nice >> $1, $2, $3 syntax. I can handle that I guess :) > > Hey, it's a Lisp! You can use almost any syntax you want. How about %1, %2, > %3: > > (defn re-do [f regex input] > (apply f (rest (re-find regex input)))) > > (re-do #(do-stuff-with %3 %1 %2) regex input) > > Or even > > (defmacro re-let [names regex input & body] > `(let [[_ ~@names] (re-find ~regex ~input)] > ~@body)) > > (re-let [year month day] date-regex line > (do-something-with year month day)) > > This one doesn't even have the bug that gaz jones's let has. ;) > > -- > 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 -- 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