zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Ray Andrews <rayandrews@eastlink.ca>
Cc: zsh-users@zsh.org
Subject: Re: nesting issue
Date: Sun, 5 May 2024 20:22:30 -0700	[thread overview]
Message-ID: <CAH+w=7b2POOLVo-BkoYaE+4ZW5KXcYGa67-3zut0hPSwkVrP7w@mail.gmail.com> (raw)
In-Reply-To: <6cfb08f8-ee3d-40fa-be88-cb10882bc1d0@eastlink.ca>

On Sun, May 5, 2024 at 6:51 PM Ray Andrews <rayandrews@eastlink.ca> wrote:
>
> Man ... I dunno, maybe the world needs different sorting logic between Canada and the US but to me it just looks like making trouble.

C sort is done in the order of the ASCII values of the characters.
Locale-based sorting is intended to match (hardcopy) dictionary order
for the represented language.  The latter may mean that "A" and "a"
both sort before "B" and "b" and so on, whereas ASCII sorts all
uppercase letters before all lowercase.  Handling of numbers and
punctuation relative to letters and numbers may also vary.

Sorting usually proceeds left to right by character position, which
means e.g. "22" sorts before "4" because ASCII "2" (062) is compared
to "4" (064).  When you ask for "numeric" sorting, each consecutive
series of digits is instead interpreted as an integer that occupies
one "position" -- but the strings are still compared position by
position, so when comparing "a2" to "10b" the character "a" is
compared to the integer "10" and sorts after it.  You only get actual
numeric ordering for "mixed" alphanumerics when the numbers occupy the
same relative positions.

Version sorting is yet another thing entirely, see
Functions/Misc/is-at-least for example.


  reply	other threads:[~2024-05-06  3:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-04 19:36 Ray Andrews
2024-05-05  3:20 ` Bart Schaefer
2024-05-05  5:39   ` Lawrence Velázquez
2024-05-05  5:40   ` Roman Perepelitsa
2024-05-05 13:52     ` Ray Andrews
2024-05-05 20:14       ` Lawrence Velázquez
2024-05-05 22:18         ` Ray Andrews
2024-05-05 23:26           ` Lawrence Velázquez
2024-05-06  1:51             ` Ray Andrews
2024-05-06  3:22               ` Bart Schaefer [this message]
2024-05-06 13:01                 ` Ray Andrews
2024-05-06  3:43               ` Lawrence Velázquez
2024-05-06 13:09                 ` Ray Andrews
2024-05-05 13:13   ` Ray Andrews
2024-05-05 19:44     ` Lawrence Velázquez
2024-05-05 20:14       ` Ray Andrews
2024-05-05 20:45         ` Lawrence Velázquez
2024-05-05 22:22           ` Ray Andrews

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7b2POOLVo-BkoYaE+4ZW5KXcYGa67-3zut0hPSwkVrP7w@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=rayandrews@eastlink.ca \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).