Last active
December 14, 2015 12:18
-
-
Save amalloy/5084918 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmulti group-data :group-by) | |
(clojure.tools.macro/macrolet [(impl [key expr] | |
`(defmethod group-data ~key [kvs#] | |
(->> (:data kvs#) | |
(group-by (fn [kv#] | |
(let [~'date (:time kv#)] | |
~expr))))))] | |
(impl :day (str (month date) "-" (day date) "-" (year date))) | |
(impl :month (str (month date) "-" (year date))) | |
(impl :year (year date))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment