Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Bug in Sort !?!?
Replies: 4   Last Post: Jun 22, 2012 3:01 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
James Stein

Posts: 126
Registered: 5/8/10
Bug in Sort !?!?
Posted: Jun 19, 2012 3:18 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

The documentation says: "Sort orders strings as in a dictionary, with
uppercase versions of letters coming after lowercase ones." It is
therefore unsurprising that { "3", "4", "4b" } are already sorted.
But who can correctly predict the three True/False values produced by
the six lines below? (And who can explain it?)

s={"3","4","4b"};
Sort[s] == s
s=Map[StringJoin[#,"."]&,s];
Sort[s] == s
s=Map[StringJoin[#,"nb"]&,s];
Sort[s] == s




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2013. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.