On Oct 3, 5:21 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > Yes. If it is important to get access bounded by the subvector's N you > can just call vec on it, at a one-time O(subvecN) cost. > > It is important to note that for vectors that are created by vec (and > literals) that have never been updated, creating the tree > representation is done lazily on update and used by the changed > versions only, so access to this root value is in fact always O(1), > for that vector and any subvectors. > > (class [1 2 3 4 5]) > -> clojure.lang.LazilyPersistentVector > > (class (vec (range 1000))) > -> clojure.lang.LazilyPersistentVector > > i.e. LazilyPersistentVectors are O(1)
Thank a lot for the explanation, Rich. I think that this should be somehow explicit in the documentation. Ciao! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---