The integrated cross-platform development tool for ANSI Common Lisp LispWorks logo

Lisp Knowledgebase



Title: What does (SETF ASSOC) do?

ID: 16005


Product: All
Version: All
OS: All

Description:
In LispWorks 3.2, there was a setter defined for ASSOC. Unfortunately, it was a bogus one because the value being set was the CDR of the alist entry, whereas ASSOC returns the entry itself. This violates the intent of setf "places" and causes great confusion when used in macros like INCF, PUSH etc.

To remove this confusion, the ASSOC setter was removed in LispWorks 4 and replaced by a new
place function, SYSTEM:CDR-ASSOC. Thus the following LispWorks 3.2 code:

(defvar *it-alist* nil)
(defun read-it (key)
 (cdr (assoc key *it-alist*)))
(defun write-it (key value)
 (setf (assoc key *it-alist*) value))


can be replaced by this in LispWorks 4:

(defvar *it-alist* nil)
(defun read-it (key)
 (system:cdr-assoc key *it-alist*))
(defun write-it (key value)
 (setf (system:cdr-assoc key *it-alist*) value))


The SYSTEM:CDR-ASSOC function is also available in LCL 5.

See Also:
Workaround:
Patch:

Hardware:N/A
Summary:What does (SETF ASSOC) do?
Bug#:
Patch Enhancement#:
Reported:6693, 4212

Top | Back