From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8914 invoked by alias); 8 Jun 2018 06:15:18 -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: List-Unsubscribe: X-Seq: 42952 Received: (qmail 17236 invoked by uid 1010); 8 Jun 2018 06:15:18 -0000 X-Qmail-Scanner-Diagnostics: from mail-io0-f172.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.223.172):SA:0(-2.7/5.0):. Processed in 1.140623 secs); 08 Jun 2018 06:15:18 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_PASS,T_DKIMWL_WL_MED,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: dana@dana.is X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=+w+Wx5OMziivxTA6824ArW3ueFEoZzwLluq5rm+yexw=; b=bJc9t2WzhSK2XA+panxzL52jDsjCvzU+5hUWQQaDAs1nDPXKYeMwvaOzYG4uoy3PMy HAjPn5T9IgUusT9THzRPp//URVQv2YRblWeB69Q1FEXyYk7IIKTX+fPmAOTBryHSYKCz t8QzrUau95QjDfX/VR4hSvnRoIW0t9TRALyCv+ybgitWWeYQP8J7twIn9r6uoiTzYe87 YqZqoEV0+5wIbFBXf9UNAt8AHi5+KPDVYCgLChZyg/Dk61x9BcEK7EkNDTUyEzoeRskk D68/XQPVitiBhgWrZ0prrN5JvStE2k+oqSGP+XLwjXMl6hXrdE5p7BFoEOmYVlndVsAj puRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=+w+Wx5OMziivxTA6824ArW3ueFEoZzwLluq5rm+yexw=; b=R0bJnGAICD9vRzS0isuTiPG8WUekOqcyi9vFds2wmWpDEQCbvRgbKF7czhKuD7v+rx KJARpfYg2gYb8Gq0tRb4Q5XOPsN1u4IK4nXmcGwqDci5oiZFynGW69h3i6GUXRcH/FVX j2yGlA/Hlclru/PTnbocHX6Yek/7ZoRLx4HhCAhPzjJWceDvjffAJVS0fS2YxlwDnFfK RSqPvDUqzC5eenOCPPNk1K/4/SeM++X1YNrKsFFhUqRhG3WoeMU0MqcP2inMhqLN/AGU OnVJ+xH61AsZqF5Ddng3GtYUEl6vn+EsPNObg0fw8X5YnKm50IoguTz/y8edDIkefx9y 8b3g== X-Gm-Message-State: APt69E3MQKB+Yryqzbr1SyBRZPRwko1weq2LrViT3ryTtr6ApkWZm/SB orxbL9yFHapYI2IoEJMYfWG6+wowHKM= X-Google-Smtp-Source: ADUXVKK80N/1OwBZybeijS6EyikYW22f395ypxZXi9vhLpYPbYTsM60PNOLow5y+mMDK7Of9JUi2BA== X-Received: by 2002:a6b:3ce:: with SMTP id e75-v6mr4387777ioi.194.1528438514646; Thu, 07 Jun 2018 23:15:14 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: Implement an "array index" subscript flag From: dana In-Reply-To: Date: Fri, 8 Jun 2018 01:15:13 -0500 Cc: Michael Milton Content-Transfer-Encoding: quoted-printable Message-Id: References: <075A01C0-8DA7-4D1B-8553-1C1C2B66D0F2@dana.is> To: "zsh-workers@zsh.org" X-Mailer: Apple Mail (2.3273) On 8 Jun 2018, at 00:46, Michael Milton = wrote: >This produces no output: >arr=3D([1]=3Da [2]=3Db) >keys=3D${arr[(k)@]} >echo $keys You're talking about the (k) subscript flag; i meant the (k) expansion = flag. See the hypothetical example in my earlier reply for how the latter works = (just use an association instead of an array). The former isn't relevant here = (array indexes aren't useful as patterns anyway), but it works like this: % local -A assoc=3D( 'a*' val1 '*a' val2 ) % print ${assoc[(k)abc]} val1 % print ${assoc[(k)cba]} val2 If the (k) expansion flag were made to work on indexed arrays it would definitely not need to do any pattern matching. dana