Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Surprising behaviour with numeric glob sort
- X-seq: zsh-workers 41197
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: Surprising behaviour with numeric glob sort
- Date: Thu, 1 Jun 2017 15:29:43 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=TByNLcA1CYMHLnM7uUw1eC3YB0jyydXWYvw5OOhc4OM=; b=vi3Y/BajcVbUDvusdYkJCwZqHzRNu8yd5dPudaF3Vj7oZcU3I4a2Q2Jy5tD8j5jB0P jt5gQMlBImHbfMKFo8Rqf4FNaqubzVvicJtLkeaLFK5RqLsZ2i7smWrGt5dv2+k4wgqL FX8mqpi7UnEtJXhIa6ciCOcKqWI1YWr6NVfgaYIVEu8Di8t+qrjjHHMY0CHhIH40ol4K BRRhO1uBf/9spkq5cVSAhvSrdDhXCjHnJ27D+eYhOlaU5KH6t+IQr4OHMH6Sv/6jeV// bGg//mFVjTc8ZvkAQMpxTLQkBJwwjDiKcky/YPoOJXml1l4GGRi7/auqOGk/GigOW++j 6gDA==
- In-reply-to: <20170531212453.GA31563@chaz.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20170531212453.GA31563@chaz.gmail.com>
On May 31, 10:24pm, Stephane Chazelas wrote:
}
} Maybe a better approach would be to break down the strings
} between non-numeric and numeric parts and use strcoll() on the
} non-numeric and number comparison on the numeric parts, stopping
} at the first difference.
I don't think that helps, in the general case. It would still mean
the sort is not stable where the numeric parts are the same but the
non-numeric part is partially-ordered.
To stabilize the sort we'd have to, for example, replace strcoll()
with something that falls back to byte value ordering whenever the
collation order of two characters is equivalent, but that requires
lookahead (doesn't work on prefixes).
Messages sorted by:
Reverse Date,
Date,
Thread,
Author