Hi, On Feb 22, 7:22 am, Mike K <[email protected]> wrote:
> (defn join-vecs [v1 v2] > (let [v2len (count v2)] > (cond > (zero? v2len) v1 > (= v2len 1) (conj v1 (first v2)) > true (recur (conj v1 (first v2)) (rest v2))))) > > (defn append [& vecs] (reduce join-vecs [] vecs)) > > user> (append '[a] '[] '[b [c]] '[d]) > [a b [c] d] > > Is there a better / more idiomatic / more efficient way? (defn append [& vecs] (reduce into vecs)) user=> (append [:a] [] [:b [:c]] [:d]) [:a :b [:c] :d] Sincerely Meikel -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
