Closed yuhan0 closed 5 years ago
It's not a bad idea. I assume it work work the same way as map
for missing keys, so it would ignore keys that aren't common throughout.
(map + [10] [5 6])
;; => (15)
(map-vals + {:foo 10} {:foo 5 :bar 6})
;; => {:foo 15}
Would it be a good idea for
map-vals
to accept multiple collections with a variadic function, just like regularmap
andmapcat
?It would break symmetry with
map-keys
andmap-kv
, which don't seem to have an intuitive analogue for being applied to multiple colls.Also I'm not sure how missing or extra keys should be handled: