From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17231 invoked by alias); 1 Mar 2011 17:09:41 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 28830 Received: (qmail 11262 invoked from network); 1 Mar 2011 17:09:29 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.220.171 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=UIbdRDzPjio2LdwGWsUsxxZ0zLPZ0EzkPFQ85slzgxY=; b=LwGXUNtiYDoy/bleIF43U+y77Iwp6yN2H6Y01AhcAIvxjTG0rdMp4bSeCjtMIJv5vN h18G8pQi100v8/NitXuwyd0qvmZofgl23DkZFWWxwsXRHGm2G4/7EG9zzvt8uYW+19Dz 7DTcvJzaB/w3BMqgzlJvziUvgFcD4WckJ++hc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=Rg5jtznDoxL3Z/faBhrIaJ+/2x9BMG+3q59zjvyRooAdd6Hyot4+rGAVomkG7lL1Kz vO6iAyozI80MCim8YQRg06A3Qdhb/VKqVUb1h4y92KIgCYfSlfiS3+DiVr7Oc6t8GK4I SaHG1XESyMESpYes7zVlojkUoEyM3bkErK8zs= MIME-Version: 1.0 In-Reply-To: <19821.9197.225140.311873@gargle.gargle.HOWL> References: <19821.9197.225140.311873@gargle.gargle.HOWL> Date: Tue, 1 Mar 2011 18:09:20 +0100 Message-ID: Subject: Re: 'K' subscript flag with associative array? From: Mikael Magnusson To: gak@klanderman.net Cc: Zsh list Content-Type: text/plain; charset=UTF-8 On 1 March 2011 17:50, Greg Klanderman wrote: > > Hi guys, what am I doing wrong here? Shouldn't this: > > zsh% echo ${(k)functions[(K)_*]} > > give all function names starting with '_'? > > It gives me nothing; the 'R' subscript flag does seem > to work for matching against the bodies of functions > and returning the names of those functions. > > thanks, > Greg > % echo ${(k)functions[( ---- subscript flags I -- all keys matched by subscript as pattern K -- all values where subscript matched by key as pattern R -- all values matched by subscript as pattern e -- interpret * or @ as a single key i -- any one key matched by subscript as pattern k -- any one value where subscript matched by key as pattern r -- any one value matched by subscript as pattern Ie, you want I, not K. What K/k does is somewhat weird, in that it interprets the keys of the arrays as patterns and check which of those match the given subscript. With I/i you don't need to specify ${(k) either, it defaults to showing the keys, but you can give ${(v) to instead get the values. -- Mikael Magnusson