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

Manual bug on REMOVE

    Date: Sat, 20 Jan 90 01:16:56 EST
    From: barmar@think.com

       Date: Fri, 19 Jan 90 12:05:38+0900
       From: kddlab!atr-la.atr.co.jp!myers@uunet.UU.NET (John K. Myers)

       Gen.7.2 manual 2A p 149 line 2: "REMOVE finds the first instance of a cons
       whose car is EQL to the indicator, and removes the pair from the assoc list."
       line 10, example: "(remove 'ruby gems) => [removed list]".
       The REMOVE key in our system defaults to IDENTITY, the correct example is of course

	 (remove 'ruby gems :key #'car) => [removed list].

    No, the manual is right.  The :key function is applied to the car of each
    cons, not to each cons.

Uh, Barry, the manual is wrong.  GEMS is an ALIST.  :KEY is applies to
each "bucket" of the ALIST.  GEMS is a list of these buckets.  But each
bucket is a CONS.

	    (setq gems (list 'diamond 'ruby 'emerald)) => (DIAMOND RUBY EMERALD)
This isn't what it gets set to in the manual.

	    (remove 'ruby gems) => (DIAMOND EMERALD)