Created
June 28, 2011 17:52
-
-
Save hyone/1051712 to your computer and use it in GitHub Desktop.
4clojure #63 - Group a Sequence
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
;; hyone's solution to Group a Sequence | |
;; https://4clojure.com/problem/63 | |
(fn my-group-by [pred coll] | |
(reduce | |
(fn [dict m] | |
(let [ret (pred m)] | |
(assoc dict ret (conj (or (dict ret) []) m)))) | |
{} coll)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment