(test [1 2 3]) is returning [], not [1 2 3], why?
(defn test [some-array]
(let [x []]
(doseq [i some-array]
(conj x i))
x))
(test [1 2 3])
EDIT: a comment below suggested I am trying an imperative approach with a functional language, and that's probably correct. What I am trying to do is build up a vector of vectors using an initial sequence of values (inside a vector in this case) as starting data. I guess I could try to transform each value in the vector and return it, but that seems harder conceptually (from an imperative mindset) than taking a starting vector and using it to build out a new one and return that.
As an example, suppose I had a function that takes 1 and returns "one", and I wanted to have a function take [1 2 3] and return [[1 "one"][2 "two"][3 "three"]].
forinstead ofdoseqwith the same result... curious about the difference between those two, though.mapeach item ofsome-varor do you want to shrink/increase the items etc?