From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.devel Subject: Re: Is there already an alist function which gets all matching elements, not just the first? Date: Wed, 05 Oct 2022 12:45:00 +0200 Message-ID: <87bkqq8s7n.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29262"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Oct 05 12:49:27 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1og1xu-0007R5-Ex for ged-emacs-devel@m.gmane-mx.org; Wed, 05 Oct 2022 12:49:26 +0200 Original-Received: from localhost ([::1]:58102 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1og1xt-0005gh-6z for ged-emacs-devel@m.gmane-mx.org; Wed, 05 Oct 2022 06:49:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52184) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1og1th-0003jU-7l for emacs-devel@gnu.org; Wed, 05 Oct 2022 06:45:05 -0400 Original-Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:40873) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1og1tf-0001tp-L2 for emacs-devel@gnu.org; Wed, 05 Oct 2022 06:45:04 -0400 Original-Received: by mail-wr1-x434.google.com with SMTP id w18so16593683wro.7 for ; Wed, 05 Oct 2022 03:45:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:gmane-reply-to-list:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=q+mzVw/LKvP3SGEYp5KfEnM+o/aGtxdaI7nNDne/a44=; b=FFadgILq0J6GLB4U52Fg69iHFArva8SdfjJiMXm5BCdCFdBoQDykbfWWsMrRdu9O07 ijid5duVZBzmAH+J194p6xDIwdxgCynOp/wPYihswtAdfY5WrT3pjKM4fBD/OX97fA6s +3DFarXYSvwt5zOzQs9hJiiP1QliVnanxiyuKFi7gfut9GAuCwZ3jGo8EUzcXSOTwy7b 3eu8pOi/RW1RaCHgEjzJFuRbutAIiT2qlM30Esp40R2WslzEc/r3I8PhmR+VnFl9ZPTW Sm23cXPfyJ5q6FJJJTYJNGUg0iJJz3QkB3aXfCnXvFBeCV78UkTQk9aI2kAqynxOAlVK G4gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:gmane-reply-to-list:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q+mzVw/LKvP3SGEYp5KfEnM+o/aGtxdaI7nNDne/a44=; b=VFIdpEwf3F45TL7BwMeHhiCDIxyBADNNZMRmKbM8k3SfaPUBefyRSazCgJ8Ay13ITA cGXnlA+CulJn1Qoeh19XjD2iTlJEnl+aaagLvK3kSZ7817Vhh45H+S2IkRpiNkAdg7AT fmo5BP5HThQzvLR4s2RK94TpJxVXy5ynoTP9jPX9c2bGtc6DKmh7i5EohVr/tNr/CLkW mSilkhY1ulaPw7JuvA/2ky03U4/aHa0AegRdwEeOuQMwZAkVkbyvpSw1cm0UxTQ4geVo QignVDFtf2nEujhw0len0AxWNJrezGMDPmDyNbsme5L0uC3vWSaVQ0kVGwv3LZlNFtjS yhIA== X-Gm-Message-State: ACrzQf11seRqLov+cR7WRL/CDO4Cabo2WjN5Uf9uObObgogBJzqdSB0Q EK7l7g2JPT2jCeXkOiIFqs88RmQD2Cw= X-Google-Smtp-Source: AMsMyM5cnpAMYrE4RvXrJ4XhqRQMo8ifPEj4fK9DcUO69lCbmLUG3mwIqGpatjR9k23i3UFusbCIgw== X-Received: by 2002:adf:de11:0:b0:22e:32bf:73f0 with SMTP id b17-20020adfde11000000b0022e32bf73f0mr11968497wrm.37.1664966701345; Wed, 05 Oct 2022 03:45:01 -0700 (PDT) Original-Received: from rltb ([2a01:e0a:3f3:fb50:37a5:6c3e:78d8:b7fc]) by smtp.gmail.com with ESMTPSA id m12-20020a5d56cc000000b0022e58c14588sm2837354wrw.85.2022.10.05.03.45.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 03:45:00 -0700 (PDT) In-Reply-To: (Alan Mackenzie's message of "Wed, 5 Oct 2022 10:00:10 +0000") Gmane-Reply-To-List: yes Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=rpluim@gmail.com; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:296953 Archived-At: >>>>> On Wed, 5 Oct 2022 10:00:10 +0000, Alan Mackenzie said: Alan> Hello, Emacs. Alan> I want to be able to get all matching elements from an alist (thinking Alan> about extending imenu). Something like Alan> (assoc-all key list) Alan> which would return a list of matches. After all, we have functions Alan> which _delete_ all matches from an alist. Alan> Does such a function already exist, perhaps in cl-*.el? Just use assoc-delete-all and invert the test: (assoc-delete-all mykey myalist (lambda (val key) (not (eq val key)))) Robert --