Forgot to mention that v in the example is defined to [[1 2] [3 4]]
On Jan 17, 3:19 pm, Gabi <bugspy...@gmail.com> wrote: > I really needed an update-in! version that works on transients. I > couldn't find one so I just modified the original update-in core (just > replaced "assoc" "assoc!"): > > (defn update-in! > "modified version of core/update-in that works on, and return > transients" > ([m [k & ks] f & args] > (if ks > (assoc! m k (apply update-in! (get m k) ks f args)) > (assoc! m k (apply f (get m k) args))))) > > user=> (persistent!(update-in!(transient v) [0] reverse)) > [(2 1) [3 4]] > > BUT when using nested paths, it fails: > > user=>(persistent!(update-in!(transient v) [0 0] inc)) > java.lang.ClassCastException: clojure.lang.PersistentVector cannot be > cast to clojure.lang.ITransientAssociative > > Any idea how to solve this?
-- 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