This file contains 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
(deftask dev | |
"Build and run development mode." | |
[i ios bool "Flag to enable iOS builds."] | |
(comp | |
(environ/environ :env {}) | |
(watch) | |
(server-with-repl :port 7888) |
This file contains 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
(defn unjoin | |
"Given a seq `rows` as retrieved from a database select involving a join, | |
return a vector of nested entities, where the top-level entities have keys | |
`parent-keys`, plus a key for each key of `child-map`, where the value for | |
that key is a vector of values specified by the value in `child-map`. | |
Where the value in `child-map` is a simple keyword, the resulting vector will | |
contain the corresponding values for that keyword in `rows`. | |
Eg (unjoin [{:id 1, :a :foo} {:id 1, :a :bar}] [:id] {:vals :a}) => |
This file contains 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
(defn expensive-fn [x] | |
(.log js/console (str "I ran (with value " x ")")) | |
(+ x 1)) | |
(defn my-memoize [f] | |
(let [results (atom {})] | |
(fn [farg] | |
(or (get @results farg) |