From: Peter Stephenson <pws@ibmth.df.unipi.it>
To: zsh-workers@math.gatech.edu
Subject: Re: PATCH: 3.1.5 + associative arrays: keys, values, and pattern subscripts
Date: Thu, 17 Dec 1998 11:17:14 +0100 [thread overview]
Message-ID: <9812171017.AA27233@ibmth.df.unipi.it> (raw)
In-Reply-To: ""Bart Schaefer""'s message of "Sun, 13 Dec 1998 15:33:32 NFT." <981213153332.ZM15459@candle.brasslantern.com>
"Bart Schaefer" wrote:
> The appended patch improves the implementation of the (kv) parameter flags
> and their interaction with the (iIrR) subscripting flags.
I finally had a look at these and a couple seem to be giving problems.
For the tests,
% typeset -A assoc
% assoc=(one eins two zwei three drei four vier five funf)
> Associative Array Ordinary Array
> ----------------- --------------
>
> ${(k)param[key]} If key has a value, If key has a value,
> then key, else empty then key, else empty
% print ${(k)assoc[four]}
0
although
% print ${(k)assoc[(i)four]}
four
> $param[(r)pat] A value in param that First value in param that
> matches pattern pat matches pattern pat
% print ${assoc[(r)v*]}
eins
although
% print ${assoc[(R)v*]}
vier
and
% print ${(v)assoc[(r)v*]}
vier
The remaining cases as far as I've tested seem fine. There is of
course the point that the ordering is random (the `first' match of
something could be any of them), but that's a feature of associative
arrays which just needs to be made clear in the docs. The syntax
seems as good as anything I can think of.
--
Peter Stephenson <pws@ibmth.df.unipi.it> Tel: +39 050 844536
WWW: http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy
next prev parent reply other threads:[~1998-12-17 10:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-12-13 23:33 Bart Schaefer
1998-12-14 7:35 ` Bart Schaefer
1998-12-17 10:17 ` Peter Stephenson [this message]
1998-12-17 13:40 ` PATCH: 3.1.5 + associative arrays: fix to keys, values Bart Schaefer
1998-12-17 16:01 ` Peter Stephenson
1998-12-17 16:52 ` Bart Schaefer
1998-12-17 17:24 ` Bart Schaefer
1998-12-18 2:44 ` Geoff Wing
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=9812171017.AA27233@ibmth.df.unipi.it \
--to=pws@ibmth.df.unipi.it \
--cc=zsh-workers@math.gatech.edu \
/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).