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

Re: Reverse the order of an array?



On Mon, Feb 11, 2002 at 01:26:20PM +0000, Oliver Kiddle wrote:

> Allowing array slices to go backwards, is a possibility though I'd not
> be suprised if implementing it caused other things to break. The
> easiest might be a parameter expension flag (r and R are gone so we'd
> need a letter. ^ perhaps as we used that for the reversed prompt
> state). Does anyone else have any views on whether we should add
> something for this and if so how?

Eww, I don't like the idea of using ^.

I picked ^ as a prompt escape because it was similar to _.  ^ is not
supposed to remind you of reversing in general (because the only thing
you can reverse is the parser state, I think).  Instead, ^ is supposed
to be a variation of _ (that just happens to be reversed) and ^ is
supposed to remind you of _.

I hope I'm making sense.  Anyway, is v or V (reVerse) used in parameter
expansion flags?  How about b or B (backwards)?

It's too bad that the same ideas (reversing) keep popping up without
a consistent way to express them.  (APL is very consistent about
expressing ideas, but I don't want to start using APL characters in
the shell!)  We could probably find a consistent way, but it would
not be backward-compatible.

-- Derek



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