On Nov 19, 8:23 pm, Chouser <[EMAIL PROTECTED]> wrote:
> _Jordan_ in IRC discovered a bug that can be distilled to:
>
> user=> (let [x [3 2 1]] (sort x) x)
> [1 2 3]
>
> The sort function mutates the vector. This can happen because the
> toArray() method of LazilyPersistenVector returns its own internal
> array, instead of creating a new array like most other collections do.
> sort then passes this along to Java's Arrays.sort() which mutates the
> array.
>
> Attached is a patch that makes LPV toArray() return a clone of the
> array. This is of course somewhat less efficient, but it seems like
> any less drastic solution leaves open the possibility of mutating the
> array inside the vector.
>
Patch applied (rev 1114) - thanks!
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
-~----------~----~----~----~------~----~------~--~---