From: Bart Schaefer <schaefer@brasslantern.com>
To: "Oliver Kiddle" <okiddle@yahoo.co.uk>
Cc: Steve Talley <stephen.talley@sun.com>, <zsh-users@sunsite.dk>
Subject: Re: Reverse the order of an array?
Date: Mon, 11 Feb 2002 18:41:17 +0000 (GMT) [thread overview]
Message-ID: <Pine.BSF.4.40.0202111806250.80443-100000@brasslantern.com> (raw)
In-Reply-To: <20020211132620.27729.qmail@web9302.mail.yahoo.com>
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?
prev parent reply other threads:[~2002-02-11 18:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-08 22:35 Steve Talley
2002-02-08 22:59 ` Bart Schaefer
2002-02-08 23:55 ` Steve Talley
2002-02-09 0:09 ` Bart Schaefer
2002-02-09 0:17 ` Steve Talley
2002-02-11 13:26 ` Oliver Kiddle
2002-02-11 18:41 ` Bart Schaefer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.BSF.4.40.0202111806250.80443-100000@brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=okiddle@yahoo.co.uk \
--cc=stephen.talley@sun.com \
--cc=zsh-users@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).