Closed hlship closed 7 years ago
That's how clojure.core/mapv
works:
user=> (def x (with-meta [1] {:foo 1}))
#'user/x
user=> (meta (mapv inc x))
nil
user=> (meta x)
{:foo 1}
I'd love a clarification on what clojure.core functions maintain metadata. I've asked on Slack but no response so far. May need to add a Clojure issue.
Collection functions don't seem to maintain metadata. So map
, filter
, remove
etc. This is why the equivalent functions in Medley act in the same way.
I've added a merging-meta
macro to my toolchest project for this purpose.
I've found that if I have a collection, a map with meta data, and execute medley/map-vals upon it, the resulting map does not have the meta-data.