From: Zach Beane
Subject: Re: Assoc to retrieve all associations?
Date: 
Message-ID: <m3wsbuqngs.fsf@unnamed.xach.com>
Francogrex <······@grex.org> writes:

> Assoc:
> Args: (ITEM ALIST &KEY (TEST '#'EQL) TEST-NOT (KEY '#'IDENTITY))
> Returns the first pair in ALIST whose car is equal (in the sense of
> TEST) to
> ITEM.  Returns NIL if no such pair exists...
>
> Suppose we have this simple example:
> : (setf my-list '((test 1) (paper 2) (pen 2) (paper 3) (paper 4) (pen
> 7)))
> : (assoc 'paper my-list)
> : (PAPER 2)
>
> OK but is there any way/function, maybe a variation of assoc, to get a
> list of all pairs in my-list with 'paper in them (instead of just the
> 1st ocurrence) without resorting to loops? Thanks

REMOVE-IF-NOT would be helpful for this task.

Zach