Clojure

sort changes its argument, if a Java array

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: Release 1.3, Release 1.4
  • Fix Version/s: Backlog, Release 1.5
  • Component/s: None
  • Labels:
    None
  • 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"
  • Patch:
    Code
  • Approval:
    Ok

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.

Activity

Hide
Stuart Halloway added a comment -

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.

Show
Stuart Halloway added a comment - 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.
Stuart Halloway made changes -
Field Original Value New Value
Priority Major [ 3 ] Minor [ 4 ]
Fix Version/s Reviewed Backlog [ 10053 ]
Issue Type Defect [ 1 ] Enhancement [ 4 ]
Hide
Andy Fingerhut added a comment -

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.

Show
Andy Fingerhut added a comment - 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.
Andy Fingerhut made changes -
Andy Fingerhut made changes -
Patch Code [ 10001 ]
Rich Hickey made changes -
Approval Ok [ 10007 ]
Fix Version/s Release 1.5 [ 10150 ]
Stuart Halloway made changes -
Resolution Completed [ 1 ]
Status Open [ 1 ] Closed [ 6 ]
Alex Miller made changes -
Fix Version/s Reviewed Backlog [ 10053 ]
Fix Version/s Backlog [ 10035 ]

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: