On Dec 16, 10:33 am, samppi <rbysam...@gmail.com> wrote: > I'm using a vector as a stack. I want to apply a function–let's call > it modify-element, one argument—to the elements from k to (- (count a- > vector) k). > > Right now, I have something like (not tested yet): > (reduce #(update-in %1 [%2] modify-element) a-vector (range k (- > (count a-vector) k))) > > Is there a better way?
It looks fine as is; you're just dealing with the vector instead of having to jump between seqs and entirely new vectors. The only part that looks weird to me is (range k (- (count a-vector) k)), since that will only give you numbers when k < count/2. -- 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