I would also vote A, seems much more straight forward. On Wed, Aug 12, 2009 at 8:02 PM, Sean Devlin<francoisdev...@gmail.com> wrote: > > Hello Clojurians, > I've been experimenting with different coding styles, and I'm > interested in the group's opinion. Which set of code is easiest to > read? > > 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 #"/")))))) > > B) Functional Composition > > (def str->date-map > (comp (trans :month (comp dec :month)) > (partial apply hash-map) > (partial interleave [:month :day :year]) > (partial map parse-int) > #(re-split % #"/")) > > C) Perl's Revenge > > (def $ partial) > (def & comp) > > (def str->date-map > (& (trans :month (& dec :month)) > ($ apply hash-map) > ($ interleave [:month :day :year]) > ($ map parse-int) > #(re-split % #"/")) > > Let me know what you all think! > > >
-- Omnem crede diem tibi diluxisse supremum. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---