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

NextPrevUpTopContentsIndex

push-end

push-end-new

Macros
Summary

Append an item to a list stored in a place.

Package

lispworks

Signature

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

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

Arguments

item

Anything.

place

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.

Values

new-place-value

A list which is the new value of place.

Description

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 
          (sys:globally-accessible
           *a-global-symbol*))

See 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 - 20 Sep 2017

NextPrevUpTopContentsIndex