Subject: Re: Assoc to retrieve all associations?
From: rpw3@rpw3.org (Rob Warnock)
Date: Sun, 15 Feb 2009 21:22:05 -0600
Newsgroups: comp.lang.lisp
Message-ID: <9MadnTQRn51ARgXUnZ2dnUVZ_jCdnZ2d@speakeasy.net>
Slobodan Blazeski  <slobodan.blazeski@gmail.com> wrote:
+---------------
| Marco Antoniotti <marc...@gmail.com> wrote:
| > (remove 'paper '((test 1) (paper 2) (pen 2) (paper 3) (paper 4) (pen 7))
| >         :test (complement 'eql)
| >         :key 'first)
|
| Very nice.
+---------------

One tiny quibble: (COMPLEMENT 'EQL) won't work [at least, not portably]
since COMPLEMENT takes a function, not a function designator. You need
to write it as (COMPLEMENT #'EQL). On the other hand, :TEST-NOT [1]
does take a function designator and thus this works portably:

    > (remove 'paper '((test 1) (paper 2) (pen 2) (paper 3) (paper 4) (pen 7))
	      :test-not 'eql :key 'first)

    ((PAPER 2) (PAPER 3) (PAPER 4))
    > 


-Rob

[1] Which I stubbornly persist in using despite its "deprecated" status! ;-}

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607