Hi, On Aug 13, 2:02 am, Sean Devlin <francoisdev...@gmail.com> wrote:
> A) Traditional definition > > (defn str->date-map > [input-string] > ((trans :month (comp dec :month)) > (apply hash-map (interleave > [:month :day :year] > (map parse-int (re-split input-string #"/")))))) I would use a bit more `let` in the whole thing. (defn str->date-map [input] (let [parts (map parse-int (re-split #"/")) date (zipmap [:month :day :year] parts) transformer (trans :month #(-> % :month dec))] (transformer date))) I find, that this way its easier to add comments to certain parts if necessary and each function call get shorter, meaning easier to read and parse. Also this function generates two classes, while the other two variants generate 6. YMMV. Sincerely Meikel --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---