Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Bug in Sort !?!?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg126962] Re: Bug in Sort !?!?
  • From: nanobio9 <kuokan.liang at gmail.com>
  • Date: Thu, 21 Jun 2012 05:15:22 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jrp94p$qbs$1@smc.vnet.net>

On 6=E6=9C=8819=E6=97=A5, =E4=B8=8B=E5=8D=883=E6=99=8218=E5=88=86, James Stein <mathgr... at stein.org> wrote:
> 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

The character code of "." is 46, smaller than "a", "1", etc. I do not
see a bug here.

Regards,
KKL



  • Prev by Date: Re: altering each member of a list that matches a certain pattern
  • Next by Date: Re: altering each member of a list that matches a certain pattern
  • Previous by thread: Bug in Sort !?!?
  • Next by thread: Re: Bug in Sort !?!?