2011/1/21 Armando Blancas <armando_blan...@yahoo.com> > I usually do something like this little sample. Calculations go in the > let bindings and new elements are conjoined into the vector. > (defn foo [n] > (loop [v [] i 0] > (if (= i n) > v > (let [x (* i i)] > (recur (conj v x) (inc i)))))) > user=> (foo 6) > [0 1 4 9 16 25] >
Hello, maybe the above example was intentionally simple, but should I suggest capturing the is in a sequence (just using range) and then : (defn foo [n] (into [ ] (map #(* % %) (range n)) HTH, -- Laurent -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en