From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1239 invoked from network); 17 Dec 1998 10:38:36 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 17 Dec 1998 10:38:36 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id FAA00023; Thu, 17 Dec 1998 05:33:36 -0500 (EST) Resent-Date: Thu, 17 Dec 1998 05:33:36 -0500 (EST) Message-Id: <9812171017.AA27233@ibmth.df.unipi.it> To: zsh-workers@math.gatech.edu Subject: Re: PATCH: 3.1.5 + associative arrays: keys, values, and pattern subscripts In-Reply-To: ""Bart Schaefer""'s message of "Sun, 13 Dec 1998 15:33:32 NFT." <981213153332.ZM15459@candle.brasslantern.com> Date: Thu, 17 Dec 1998 11:17:14 +0100 From: Peter Stephenson Resent-Message-ID: <"vlEkU1.0.I.0uDUs"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/4829 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu "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 Tel: +39 050 844536 WWW: http://www.ifh.de/~pws/ Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy