We're updating the issue view to help you get more done. 

Sorting vector yields non-indexed ArraySeq

Description

Sorting a vector gives back an ArraySeq with O(n) gets instead of O(log N) gets. This means it can be more efficient to take a vector, sort, then turn it back into a vector.

Cause: sort works by copying the collection to be sorted into an array, calls Arrays/sort to sort it, and then returns a seq on the sorted array. The seq returned is an ArraySeq and doesn't implement Indexed.

Alternatives:

1. Make ArraySeq (and primitive specializations thereof) implement Indexed, providing constant time lookup by index.
2. Specialize sorting for different collection types
3. ???

Environment

None

Status

Assignee

Unassigned

Reporter

Alex Miller

Labels

Approval

Triaged

Patch

Code

Priority

Major