All Manuals > LispWorks® User Guide and Reference Manual > 38 The LISPWORKS Package


push-end-new Macros


Append an item to a list stored in a place.




push-end item place => new-place-value

push-end-new item place &key key test test-not => new-place-value

A generalized reference form as described in section 5.1.1 Overview of Places and Generalized Reference of the Common Lisp HyperSpec.
key, test, test-not
Function designators.
A list which is the new value of place.

The macros push-end and push-end-new are analogs to push and pushnew, except that they append item to the end of the list rather then prepend it.

place must contain a proper list.

push-end sets place to a copy of this list with item appended in the end.

push-end-new does the same as push-end, except when item is already on the list, in which case push-end-new does nothing. The check is done using the values of key, test and test-not in the same way that pushnew does.

The return value new-place-value is the value of place after the operation. Except when item is already in the list, it is always a new list.

Notes: Multithreading

push-end and push-end-new are not atomic.

If place is globally accessible and may be read by another thread without synchronization (by a lock or other synchronization mechanism), then you need to wrap place by globally-accessible, for example:

(push-end my-item 

See 19.3.4 Making an object's contents accessible to other threads for a discussion.

push and pushnew also have the same issues with Multithreading.

LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:41