From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-users-return-23726-ml=inbox.vuxu.org@zsh.org X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 9457abc2 for ; Fri, 26 Oct 2018 08:21:45 +0000 (UTC) Received: (qmail 23468 invoked by alias); 26 Oct 2018 08:21:33 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 23726 Received: (qmail 26938 invoked by uid 1010); 26 Oct 2018 08:21:33 -0000 X-Qmail-Scanner-Diagnostics: from mail-it1-f182.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.166.182):SA:0(-1.9/5.0):. Processed in 2.417615 secs); 26 Oct 2018 08:21:33 -0000 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=qzM8EKN/Zkw3e89rrYbFEFck1+zgi7tL86OWdfRZ4GI=; b=aUUV08eeL4uVq7dNjXsrK/Q/XaFEL6rqC+ofiQ/czlDPpkORBOlTVSdcMInN5Nkt1b XKK1Dcx5qdV3jD3+N2PHIqOvNQZrMOcEvW4mVBk+V+VoxIkr+nGL+QgAUihnTsweujSu miIkb/b/SldUahWlWOFxWj/QLuog3OaxfL77edlNbazB0jupireJvlsWztugSwTVuiXX GT5x6kFTOX1GwcsU5tcfKGDAto1cAJnT/77TaoP8GuP3+L3gYovJaDHv1lme3vZb1ggE 4Blx8VhYNwItJScer9WIV32kTWM9AuKrEDw/w4BnMfbl96dl4q+4kZwbe7FcNqLhTUnt ipVw== 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=qzM8EKN/Zkw3e89rrYbFEFck1+zgi7tL86OWdfRZ4GI=; b=o4vLQ2GXjACpcBgl9/7+ytnIKriiJHbdew9dU9EafPpG74gW6nv/lBDoikpwwTjeqg pKQF6/kXoazXyAkLXZPLKwyl/Opx5t3Kf6luiqTG6aZBj34rIkLMZRatb4vWuR4gFpL0 vqkPdiO3PH4okm2UaMNF0b2d9USJLGF1d5BUtQQjtjmAIq5FJKvSnrL1fFk6YM0OkkSy 7I1v6oyS+gJD3uWQbl5AfqMEHsFvfOfB4ldgAiLJAvZTVp8xrdjcwY1NwdqS4RfnT6Sw V0rmPFv9pnk89SkHvPBymtC9r2HTotfH7kGAcO+kOJMAHnPRN+cvE4ApY0Bny7dY2gft iXjw== X-Gm-Message-State: AGRZ1gKdbzMOd5nubBjF7PBEmNQG4ztabu0D1bd+9hrqa/fVBUy7WpEx +0ppOtG5x2RyaM2/eaRcFloCEA== X-Google-Smtp-Source: AJdET5dd6uiZ9fAVNB53ORXdpprkDPhN3+5DGOb5VuKXSV0CoVN+5s5WC2ALtUYBYoHvL2k3xGEIXw== X-Received: by 2002:a02:b716:: with SMTP id g22-v6mr1834535jam.79.1540542087671; Fri, 26 Oct 2018 01:21:27 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.4 \(3445.8.2\)) Subject: Re: Filtering array on index From: dana In-Reply-To: Date: Fri, 26 Oct 2018 03:21:25 -0500 Cc: Zsh Users Content-Transfer-Encoding: quoted-printable Message-Id: <543FBD7D-4178-47A4-AA19-0635D4661DFF@dana.is> References: <63A34262-4216-4AFD-93B6-035CCEE44908@dana.is> To: =?utf-8?Q?Jesper_Nyg=C3=A5rds?= X-Mailer: Apple Mail (2.3445.8.2) On 26 Oct 2018, at 02:59, Jesper Nyg=C3=A5rds = wrote: >The following doesn't quite do what I want, since I can find no way of >specifying that I want the "-f" prefix removed from the elements in >$overrides, before its elements are then removed from the $filter list: > >% filters=3D(); overrides=3D() >% set -- -v one -v two -f one >% zparseopts -D -E v+:-=3Dfilters f+:-=3Doverrides >% print -lr -- ${${filters#-v}:|overrides} >one >two > >(I wanted only "one" to be printed) If the idea is to remove the overrides from the filters, shouldn't you = have wanted only 'two' printed? If so, i guess this might qualify as 'compact': ${filters:#${~:-(${(j<|>)${(b)overrides/#-f/-v}})}} Add (M) to the outer expansion if you want it the other way around And if you still need the -v removed when you're done, just wrap the = whole thing in ${...#-v} dana