vector - Clojure: transform list of pairs/n-tuples into n-tuple of lists -
this question has answer here:
- matrix transposition in clojure 2 answers
given list of n-tuple,
[[1, "a"], [2, "b"], [3, "c"]] i obtain
[[1, 2, 3]["a", "b", "c"]] i think available function in std. library, in python zip(*lst). not find unfortunately.
otherwise guess can come implementation using reduce, etc. prefer standard clojure function :)
(apply map vector [[1, "a"], [2, "b"], [3, "c"]]) if need vector can use mapv:
(apply mapv vector [[1, "a"], [2, "b"], [3, "c"]])
Comments
Post a Comment