Vectors are designed for contiguous/sequential data. The case below requires "removing" elements at arbitrary (keyed) locations in a collection. Idiomatically, a map is better suited to the job. With a vector you'll be left reassembling your key.
It's worth noting that calling assoc on a vector is only valid for indexes <= count. Vectors aren't sparse. There's a section in the API docs listing functions to create, examine, and "change" each type of collection. Very nicely organized, worth checking out. http://clojure.org/data_structures#toc12 - Jeff On Wednesday 18 February 2009 03:19, James Reeves wrote: > > On Feb 18, 5:38 am, CuppoJava <patrickli_2...@hotmail.com> wrote: > > (defn remove_at [coll & indexes] > > (map second > > (remove #(some #{(first %)} indexes) (map vector (iterate inc > > 0) coll)))) > > I'd have thought you could use dissoc, but it seems that only assoc > works with vectors. I wonder if this is an oversight or there is some > reason behind it? > > - James --~--~---------~--~----~------------~-------~--~----~ 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 clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---