push-aconsGBBopen Toolspushnew-elementspushnew-aconsGoTo Top

pushnew-acons   item value place &key key test test-not => new-place-value[Macro]

Purpose
Replace the value associated with item in an association list stored in place or add a new (item . value) cons to the association list if there is no existing association for item.

Package   :gbbopen-tools

Module   :gbbopen-tools

Arguments and values

item     An object
value     An object
place     A form which is suitable for use as a generalized reference
key     A function designator specifying a function object of one argument, or nil (default is nil)
test     A function designator specifying a function object of two arguments that returns a generalized boolean (default is #'eql)
test-not     A function designator specifying a function object of two arguments that returns a generalized boolean (use of :test-not is deprecated)
new-place-value     An association list

Returns
An association list (the new value of place).

See also
    push-acons
    pushnew/incf-acons

Examples

  > (setf alist nil)
  nil
  > (pushnew-acons 'x 1 alist)
  ((x . 1))
  > (pushnew-acons 'y 2 alist)
  ((y . 2) (x . 1))
  > (pushnew-acons 'x -1 alist)
  ((y . 2) (x . -1))
  > alist
  ((y . 2) (x . -1))
  >


The GBBopen Project


push-aconsGBBopen Toolspushnew-elementspushnew-aconsGoTo Top