From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: RE: ${_comps[(K)*diff*]}
Date: Fri, 10 Mar 2000 11:32:18 +0100 (MET) [thread overview]
Message-ID: <200003101032.LAA03460@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Andrej Borsenkow"'s message of Fri, 10 Mar 2000 13:04:29 +0300
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
next reply other threads:[~2000-03-10 10:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-03-10 10:32 Sven Wischnowsky [this message]
2000-03-10 10:57 ` ${_comps[(K)*diff*]} Andrej Borsenkow
-- strict thread matches above, loose matches on Subject: below --
2000-03-10 9:54 ${_comps[(K)*diff*]} Sven Wischnowsky
2000-03-10 10:04 ` ${_comps[(K)*diff*]} Andrej Borsenkow
2000-03-09 16:50 ${_comps[(K)*diff*]} Andrej Borsenkow
2000-03-09 18:43 ` ${_comps[(K)*diff*]} Bart Schaefer
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=200003101032.LAA03460@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.auc.dk \
/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).