beginners

Ryan 2025-08-05T16:37:25.062949Z

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)

VardriPoise 2025-08-05T16:39:53.072029Z

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

👍 1
2025-08-05T16:40:21.761329Z

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

👏 2
Ryan 2025-08-05T17:04:15.706359Z

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!

Ryan 2025-08-05T16:38:08.933429Z

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