<< Back to previous view

[CLJ-892] sort changes its argument, if a Java array Created: 08/Dec/11  Updated: 26/Jul/13  Resolved: 18/May/12

Status: Closed
Project: Clojure
Component/s: None
Affects Version/s: Release 1.3, Release 1.4
Fix Version/s: Backlog, Release 1.5

Type: Enhancement Priority: Minor
Reporter: Stephen Compall Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None

java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.4) (6b22-1.10.4-0ubuntu1~11.04.1)

Attachments: Text File clj-892-clarify-sort-sort-by-doc-strings-patch1.txt    
Patch: Code
Approval: Ok


user> (let [a (to-array [32 11])]
(prn (seq a))
(sort a)
(prn (seq a)))
(32 11)
(11 32)

Where the second line printed ought to be the same as the first.

Comment by Stuart Halloway [ 09/Dec/11 9:37 AM ]

This is an enhancement request, since the docs for sort make no promise one way or the other.

For performance, I prefer the current behavior, so another possibility is a clarifying doc string.

Comment by Andy Fingerhut [ 26/Mar/12 5:32 PM ]

clj-892-clarify-sort-sort-by-doc-strings-patch1.txt of Mar 26, 2012 applies cleanly to latest master on that date. Only doc string changes, to make it clear that by sort and sort-by will modify Java arrays given as arguments.

Generated at Thu Jan 18 22:03:10 CST 2018 using JIRA 4.4#649-r158309.