4 ms·
Don't understand why you would need seperate functions for those three first. map-keys would basically just be map with (keys coll), map-values would be with (v
by Skinney 12y ago
Don't understand why you would need seperate functions for those three first. map-keys would basically just be map with (keys coll), map-values would be with (vals coll) and entries would just be a normal map, as hashmaps in Clojure are seqs and mapping over hashmap returns entries as [key val]. A simple destructuring in your map function and you're good to go.
Don't quite understand what group-by-1 and group-by-2 does though. Elaborate?
- guard-of-terra 12y agoThe need of repeating exactly the same destructuring or transformation (keys, uncurrying tuple) constaints your thought. You need to have an instrument that fits your domain perfectly. group-by-[12] groups a [[k, v]] list by either k or v, of course you can do this with group-by first, but see above.
- coldtea 12y ago>You need to have an instrument that fits your domain perfectly. Well, then you have to built it FOR your domain. It would strange to have the built-in functions fit ANY domain.