[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: assoc question
- To: vax135!lcuxle!elia@ucbvax.Berkeley.EDU (Weixelbaum Elia)
- Subject: Re: assoc question
- From: "Daniel L. Cerys" <Cerys@XX.LCS.MIT.EDU>
- Date: Fri, 20 Nov 87 17:22:03 EST
- Cc: firstname.lastname@example.org
- In-reply-to: Msg of Thu, 19 Nov 87 10:41:03 EST from vax135!lcuxle!elia@ucbvax.Berkeley.EDU (Weixelbaum Elia)
- Sender: cerys@RTS-12
> Franz Common Lisp and Xerox Common Lisp
> follow the book and permit :key for just assoc (and rassoc), while KCL and
> TI Explorer don't allow :key at all.
On your Explorer, you are probably either using Zetalisp or you are
running with very old software (Release 2). The Common-Lisp ASSOC
in Release 3.0 of the Explorer follows CLtL and allows for a :KEY arg.
> In any event, there should certainly
> not be an inconsistency.
I agree, but I think all of the ASSOC functions should accept a :KEY
arg. Alists are commonly used in Lisp. Of the following, the ASSOC-IF
version is much easier to read.
;;ALIST is an alist where the CAR's are objects (eg persons)
(assoc-if #'over-the-hill-p alist :key #'age)
(find-if #'over-the-hill-p alist :key #'(lambda (x) (age (car x))))
Since alists are in common use, and it would make the ASSOC functions
consistent with FIND et al, the ASSOC functions should also accept :KEY