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

Re: Reverse the order of an array?



On Feb 13,  4:36pm, Oliver Kiddle wrote:
}
} > How about if (oa) means "sort in array index order" and (Oa) means
} > "sort in reverse array index order"?
} 
} Should we perhaps also add an argument to the `o' glob qualifier to
} specify no sorting (i.e. pure directory order). If so, it should
} perhaps be the same letter as here in which case `a' is not available.

There are already a number of inconsistencies between glob qualifiers
and parameter flags in this regard.  Order matters in glob qualifiers;
e.g. (n) by itself is numeric sorting (which we don't yet do in arrays),
(no) is an error, and (on) means sort by name.  In parameter flags (i)
by itself is meaningless, but both (io) and (oi) mean to sort case-
independently (an option that we don't have in the glob qualifiers).

Also, directory order is not likely to have been carefully crafted by
the user the way array ordering is.  The main use of pure directory
order would be to avoid sorting when there are a large number of files.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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