help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "assoc" for returning ALL associations for a given key


From: Pascal J. Bourguignon
Subject: Re: "assoc" for returning ALL associations for a given key
Date: Tue, 05 May 2009 12:15:52 +0200
User-agent: Gnus/5.101 (Gnus v5.10.10) Emacs/22.2 (gnu/linux)

florian <lorian@fsavigny.de> writes:
> [...]
> But I am wondering whether that would have been necessary - perhaps I
> am overlooking something? Otherwise, would anybody care to comment
> about the efficiency of the above function?

(require 'cl)
(remove* key a-list :key (function car) :test-not (function eql))


(let ((key :one)
      (a-list '((:one . "un")   (:two . "deux")
                (:one . "eins") (:two . "zwei")
                (:one . "one")  (:two . "two"))))
  (remove* key a-list :key (function car) :test-not (function eql)))
-> ((:one . "un") (:one . "eins") (:one . "one"))



-- 
__Pascal Bourguignon__


reply via email to

[Prev in Thread] Current Thread [Next in Thread]