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

Re: Associative array sorting



On 1/19/24 14:18, Bart Schaefer wrote:
I was just looking at this in the manual --

a
      Sort in array index order; when combined with 'O' sort in reverse
      array index order.  Note that 'a' is therefore equivalent to the
      default but 'Oa' is useful for obtaining an array's elements in
      reverse order.

Like (o), (a) applies after the param is turned into an ordinary
array, so "equivalent to the default" kind of gets us off the hook,
but this would be the obvious place to attach sorting the associative
array by key rather than by raw hash traversal.


Sounds like a good idea to me.




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