Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defn lower-key [x]
- (if (or (string? x) (keyword? x))
- (-> x name .toLowerCase keyword)
- x))
- (defn map-keys
- "applies f to each key of m. also to keys of m's vals and so on."
- [f m]
- (zipmap
- (map (fn [k]
- (f k))
- (keys m))
- (map (fn [v]
- (if (map? v)
- (map-keys f v)
- v))
- (vals m))))
- (map-keys lower-key
- {:aBaB 123
- "CAsasas" {1 "doesn't apply to non-string non-keyword keys"
- :yoGURt "mmMMm"
- :notVALUES "either"}})
Add Comment
Please, Sign In to add comment