From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22742 invoked from network); 12 Nov 1998 08:22:34 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 12 Nov 1998 08:22:34 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id DAA22064; Thu, 12 Nov 1998 03:21:56 -0500 (EST) Resent-Date: Thu, 12 Nov 1998 03:21:56 -0500 (EST) To: "Bart Schaefer" Cc: zsh-workers@math.gatech.edu Subject: Re: PATCH: 3.1.5 - sample associative array implementation References: <9811111358.AA51361@ibmth.df.unipi.it> <981111125236.ZM3587@candle.brasslantern.com> Mime-Version: 1.0 (generated by tm-edit 7.108) Content-Type: text/plain; charset=US-ASCII From: Timothy Writer Date: 12 Nov 1998 03:22:06 -0500 In-Reply-To: "Bart Schaefer"'s message of "Wed, 11 Nov 1998 12:52:36 -0800" Message-ID: X-Mailer: Gnus v5.5/XEmacs 20.4 - "Emerald" Resent-Message-ID: <"lKiuO1.0.hO5.ZgfIs"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/4609 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu "Bart Schaefer" writes: > On Nov 11, 3:00pm, Timothy Writer wrote: > } Subject: Re: PATCH: 3.1.5 - sample associative array implementation > } > } In ksh93 associative arrays are declared using "typeset -A". > > This could easily be mimicked. Good. > } They use the > } same syntax as indexed arrays, e.g. "foo[bar]=baz"; the text within [] is > } subject to variable expansion and whitespace counts. > > Hrm. Zsh currently can't handle whitespace inside the [ ]; and I'm not > sure the paramtab implementation I did will work with keys that aren't > parsable as "identifier". > > Otherwise this is good. > > How can you (or can you not) assign to multiple elements simultaneously? I don't know, I don't think you can. Unfortunately, I'm not a ksh93 expert, I just paraphrased the above info from the ksh93 reference in "Desktop Korn Shell Graphical Programming". > } The following special notation is used to get all keys: > } > } "${!arrayname[@]}" > > Exactly what about that is the special notation? The `!'? Does ksh93 I guess so, "special" is the book's term. > recognize other special characters in that position? Is there any way > to get both the keys and the values in a single expansion? As far as I can tell, only "!" and (of course) "#" are "special" in that position. However, "${!variable}" is also special syntax for name reference variables, e.g.: B=2 nameref A=B print $A # prints: 2 print ${!A} # prints: B Does zsh have namerefs? I don't think there's a way to get both keys and values in a single expression. -- Tim Writer Tim.Writer@ftlsol.com FTL Solutions Inc. Toronto, Ontario, CANADA