Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: assoc array memory mucking, and semantics of patterned keys
- X-seq: zsh-workers 4659
- From: Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx
- Subject: Re: assoc array memory mucking, and semantics of patterned keys
- Date: Tue, 17 Nov 1998 09:47:58 +0100
- In-reply-to: ""Bart Schaefer""'s message of "Tue, 17 Nov 1998 00:15:08 NFT." <981117001508.ZM4342@xxxxxxxxxxxxxxxxxxxxxxx>
"Bart Schaefer" wrote:
> The final possibility is to change the meanings of (r) and (i) when an
> AA is involved, so that (r) means search the values and (i) means search
> the keys.
Without thinking too hard, because I want to get some work done today,
I think I prefer this, because the (k) and (v) flags always refer to
what's returned, while the (r) and (i) flags always refer to what's
being searched. It's both neat and powerful. It's maybe annoying
it's different from normal arrays, but I think understandably so.
Once you've got the point that (i) tells you to search the index, not
return it, it's entirely logical. Otherwise the meanings of (k) and
(i) are mixed in a slightly messy way. It just needs one sentence in
the manual saying
i [what happens with ordinary arrays]
With associative arrays, specifies that the keys of the array
should be searched for a match. The part of the array returned
is controlled by the (k) and (v) substitution flags in this case.
and pretty much everything else is covered already.
--
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx> Tel: +39 050 844536
WWW: http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56100 Pisa, Italy
Messages sorted by:
Reverse Date,
Date,
Thread,
Author