From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1583 invoked from network); 11 Feb 2002 13:26:41 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 11 Feb 2002 13:26:41 -0000 Received: (qmail 7269 invoked by alias); 11 Feb 2002 13:26:23 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 4671 Received: (qmail 7257 invoked from network); 11 Feb 2002 13:26:21 -0000 Message-ID: <20020211132620.27729.qmail@web9302.mail.yahoo.com> Date: Mon, 11 Feb 2002 13:26:20 +0000 (GMT) From: =?iso-8859-1?q?Oliver=20Kiddle?= Subject: Re: Reverse the order of an array? To: Bart Schaefer , Steve Talley Cc: zsh-users@sunsite.dk In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit --- Bart Schaefer wrote: > > Hmm, I should have thought of that. > > eval osvers\=\( \"\$osvers\[{$#osvers..1}\]\" \) > Not very intuitive that is it. I recently wanted to loop over an array's elements in reverse and though I could do it with a for loop counting the indices backwards I did think that there ought to be a better way. 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? Oliver __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com