Skip to content

Instantly share code, notes, and snippets.

View BuddhiLW's full-sized avatar

blw BuddhiLW

View GitHub Profile
@BuddhiLW
BuddhiLW / group-and-keywordize-by-key.clj
Created May 18, 2023 18:44
Group and keywordize data, with Clojure (useful for requests with ids as strings)
;; keywordize-at-keys: https://gist.github.com/vvvvalvalval/d31f8980045f3da3b3415092f6db32b6
(defn associate-by [f coll]
(into {} (map (juxt f identity) coll)))
(defn associate-by-kkeyword-value
"Associate by key the key-work values and transform key to keyword, as well as it's value.
Generally, used for grouping data by the unique values in a coll, coming from requests."
[key coll]
(->> coll