[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is there already an alist function which gets all matching elements,
From: |
Robert Pluim |
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 |
>>>>> On Wed, 5 Oct 2022 10:00:10 +0000, Alan Mackenzie <acm@muc.de> 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
--