Re: Bug + Patch: LazilyPersistentVector mutated by sort

2008-11-19 Thread Rich Hickey
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

Bug + Patch: LazilyPersistentVector mutated by sort

2008-11-19 Thread Chouser
_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 colle