how to paritally flatten a list in clojure? -
let's have data structure so:
[[1 2 3] [4 5 6] [[7 8 9] [10 11 12]]] and want end is:
[[1 2 3] [4 5 6] [7 8 9] [10 11 12]] is there function automatically?
basically i'm converting/transforming sql result set csv, , there rows transform 2 rows in csv. map function in normal case returns vector, returns vector of vectors. clojure.data.csv needs list of vectors only, need flatten out rows got pivoted.
mapcat useful mapping each element can expand 0 or more output elements, this:
(mapcat #(if (vector? (first %)) % [%]) data) though i'm not sure if (vector? (first %)) sufficient test data.
Comments
Post a Comment