From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3930 invoked from network); 10 Mar 2000 10:34:13 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 10 Mar 2000 10:34:13 -0000 Received: (qmail 8897 invoked by alias); 10 Mar 2000 10:32:57 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10050 Received: (qmail 8882 invoked from network); 10 Mar 2000 10:32:56 -0000 Date: Fri, 10 Mar 2000 11:32:18 +0100 (MET) Message-Id: <200003101032.LAA03460@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: "Andrej Borsenkow"'s message of Fri, 10 Mar 2000 13:04:29 +0300 Subject: RE: ${_comps[(K)*diff*]} Andrej Borsenkow wrote: > > > > > > What you miss is that [(k)...] and [(K)...] don't do pattern-matching > > > on the keys. I have an idea what's going wrong, but I don't have time > > > to fix it right now. > > > > (I don't see anything wrong here, what am I missing?) > > > > k > If used in a subscript on a parameter that is not an associative > array, this behaves like `r', but if used on an association, it > makes the keys be interpreted as patterns and returns the first > value whose key matches the EXP. > > K > On an associtation this is like `k' but returns all values whose > keys match the EXP. On other types of parameters this has the same > effect as `R'. I know that -- I've written it. Again: so what? Looking at the ouput you got: bor@itsrm2% print ${_comps[(K)*diff*]} === nothing === The keys of $_comps are used as patterns (none of them is a real pattern, they are just strings -- the names of commands and special context), but none of them matches the string `*diff*'. So you get nothing. Of course. Right? Maybe what you wanted is the (I) flag? (That (I) and (K) do what they do and that they are named the way they are named may be a bit irritating -- probably less when thinking about normal arrays instead of associations -- but that has historical reasons. (K) just came later.) Bye Sven -- Sven Wischnowsky wischnow@informatik.hu-berlin.de