Zsh Mailing List Archive
Messages sorted by:
Re: Feature request: two level sorting
- X-seq: zsh-users 21674
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Feature request: two level sorting
- Date: Thu, 16 Jun 2016 06:53:04 +0200
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=V43M5BHpmZ4VYNWnr78Deq/7TXzc6gAPoAhV3ozPALg=; b=c1dyXeLeYZI6MxsOKRuIVqUQsbEkst4KOeGMjbF6VM9XVvf4STdENhMg5OOrVStGzF DgwfcFe20vyggoYJa6EkE7yQfVMBYK/5hWjtwAPsOgm8bUCkRV33BRDRZU6tlE2HSQQe V9M2DKDJBxlWpA1dQpNyfO34486W0wMKW1IjoTyUnO6kPVeAeVff1EXLpr9azjkiN331 SCfDXkWQ9jEaMtdIp/J5rx1sumwvWQEm/2dcO9oC6LiUnmPg/p9XtpM/tz4DMzqTaEu4 n32nmnGksMs+zNSq8rbHfKhCe0VMIy7t7sktPJjzfBZSWD/6Bl/Gw/LKRVJdkAh++Lxw ELVQ==
- In-reply-to: <160615101239.ZM21280@torch.brasslantern.com>
- List-help: <mailto:email@example.com>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVAsLwNVP0vjTvBebP5u+Ahe03yXaWxkvytOx4EPkN4V9Q@mail.gmail.com> <160615101239.ZM21280@torch.brasslantern.com>
On 15 June 2016 at 19:12, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> "Feature request: A one-line parameter expansion that converts an
> array to a two-dimensional array by parsing with a pattern match,
> sorts the 2d array on one axis using multiple values of the other
> axis, and then reassembles the original one-dimensional array
> elements again in the new ordering."
Not sure what you mean, I didn't propose such functionality. I went
for a compromise. A shellish or hackish compromise. What can be done
without multi-dimensional arrays in this case? Not much. Except for
providing separate array. A shellish solution. I think such style
gives various opportunities later.
Reading this after hour I see what you mean. You converted two line
"gather array, pass to parameter" to one line "call with pattern
gathering array". Should we do this? It's not shellish. It might
however be Zshish ;) i.e. reasonable, one line, difficult at first
glance. I will keep in mind the call for syntax through the day and
see what I can came up with.
> Can you even suggest a syntax for this that wouldn't look worse than
> the "for" loop you already wrote?
I don't think the for loop is that bad. It's typical imperative code.
One can code in Zsh this way. I had a choice whether to solve
imperatively or via modifying the string in similar manner you later
show, so that "sort string" would equal "sort with grouping". I've
chosen imperative option.
Messages sorted by: