beginners 2025-08-05

is there a better way to map a vector of vectors to a vector of maps than

(mapv #(identity {:key-1 (nth % 0) :key-2 (nth % 1) :key-3 (nth % 2) :key-4 (nth % 3) v)

do you mean something like: (zipmap [:keya :keyb :keyc :keyd] [1 2 3 4])?

👍 1

(mapv (fn [[a b c d]] {:k1 a :k2 b :k3 c :4 d}) v)

👏 2

Yes I couldn't remember the name of zipmap but using destructuring also looks like a very tidy way to do it as well! Thanks for the answers!

the input is consistently the same length, and always maps to the same key sequence