> 2) Whats a good way to add some items into the middle of a list
>
> You could split-at then pick out the results and use concat with new
> items in-between
> Again, java add index not supported

Is this what you had in mind?

(defn add-in-the-middle [src middle-pos items]
   (concat (take middle-pos src) items (drop middle-pos src)))

Usage:
user=> (take 20 (add-in-the-middle (iterate inc 1) 3 (list Math/PI)))
(1 2 3 3.141592653589793 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19)

Cheers,
Stuart 

--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to