When we call keys on a map, is the order of keys in the resulting seq guaranteed to be the same as the order of values when we call vals on the same map?
In other words, is it ok to map a function f over the contents of a map like this:
(map #(f %1 %2) (keys m) (vals m))
If not, is there an equivalent to perl's each in clojure? Or perhaps the inverse function of zipmap?
You can iterate over the map, you get key val pairs,
(map (fn [[key val]]
(println key val)) {:a :b :c :d})
pretty much all clojure data structures are seqable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With