Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Feature request: two level sorting



On Jun 16,  6:53am, Sebastian Gniazdowski wrote:
} Subject: Re: Feature request: two level sorting
}
} On 15 June 2016 at 19:12, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
} >
} > "Feature request: A one-line parameter expansion that ...
} 
} Not sure what you mean, I didn't propose such functionality.

OK, I see.  You were actually proposing that the final solution use a
second array to group the first one; I misread that as only an example
of how to get the result you wanted.

So what you're really suggesting is --

Given two arrays AA and AB which must be of equal length:
(1) sort AB and apply that new ordering to the elements of AA
(2) except that if two elements of AB are the same, use another
    sort to order the corresponding elements of AA

-- and you want a syntax that passes the name of AB, the order to be
applied to AB, and the secondary order of AA, via the expansion flags
of a reference to AA.

Have I got it this time?

What if you need "two levels" of sorting for the desired order AB?

} > 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.

I wouldn't have said so either, except that you want a new feature to
replace it, so you must not like having to use the loop.



Messages sorted by: Reverse Date, Date, Thread, Author