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!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
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
-~----------~----~----~----~------~----~------~--~---