sort changes its argument, if a Java array

Description

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

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

Environment

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

Attachments

1

Activity

Show:

Andy Fingerhut March 26, 2012 at 11: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.

Stuart Halloway December 9, 2011 at 3:37 PM

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.

Completed

Details

Assignee

Reporter

Approval

Ok

Patch

Code

Priority

Affects versions

Fix versions

Created December 9, 2011 at 1:14 AM
Updated July 26, 2013 at 4:34 PM
Resolved July 26, 2013 at 4:34 PM