On Oct 3, 10:12 am, Cesare <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I'm reading the Clojure documentation and there is something I don't
> understand about vector functions.
>
> "Vectors support access to items by index in log32N hops"
>
> but this seems in contrast with the fact that 'subvec' is O(1) (few
> lines later).
>
> If subvec was O(1), it would be possible to select a sub-vector [i, i
> +1)
> (N=1) and then read its only element in O(1).
> This would be a way to access items by index in O(1).
>
> Rich, could you explain that?
>

Subvectors can be created in constant time because they copy nothing
and share structure with the original. So, they are effectively views
on the original vector, and share its access times. No magic here,
sorry :)

Rich

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