Common Lisp the Language 2nd Edition


next up previous contents index
Next: Multiple Values Up: Control Structure Previous: The ``Program Feature''

7.9. Structure Traversal and Side Effects

change_begin
X3J13 voted in January 1989 (MAPPING-DESTRUCTIVE-INTERACTION)   to restrict side effects during the course of a built-in operation that can execute user-supplied code while traversing a data structure.

Consider the following example:

(let ((x '(apples peaches pumpkin pie)))
(dolist (z x)
(when (eq z 'peaches)
(setf (cddr x) '(mango kumquat)))
(format t " S " (car z))))

Depending on the details of the implementation of dolist Depending on the details of the implementation of dolist (MAPPING-DESTRUCTIVE-INTERACTION)   ml2669 H