From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12504 invoked from network); 11 Feb 2002 18:41:35 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 11 Feb 2002 18:41:35 -0000 Received: (qmail 8934 invoked by alias); 11 Feb 2002 18:41:21 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 4672 Received: (qmail 8923 invoked from network); 11 Feb 2002 18:41:20 -0000 Date: Mon, 11 Feb 2002 18:41:17 +0000 (GMT) From: Bart Schaefer Sender: lantern@brasslantern.com To: =?iso-8859-1?q?Oliver=20Kiddle?= cc: Steve Talley , Subject: Re: Reverse the order of an array? In-Reply-To: <20020211132620.27729.qmail@web9302.mail.yahoo.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Mon, 11 Feb 2002, 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. Right now, using a backwards array slice references an imaginary "empty element" to the left of the left end of the slice; assigning to that imaginary element makes it real. E.g.: zsh% x=(a b c d e) zsh% x[4,2]=(y) zsh% echo $x a b c y d e This was motivated by desiring to have a syntax for inserting elements into the array; "forwards" array slices only allow for replacement. > The easiest might be a parameter expension flag (r and R are gone so > we'd need a letter. We could also use a subscripting flag (though that doesn't help with r/R). > ^ perhaps as we used that for the reversed prompt state). No, I don't like that. ${(^)^x} is just too confusing. How about if (oa) means "sort in array index order" and (Oa) means "sort in reverse array index order"? There's precedent with (oi) and (Oi) for case-insensitive sorting. Obviously (oa) is equivalent to the default, but so what?