vle-set-cdrassoc


(vle-set-cdrassoc  key  lst  val)

searches 'lst' list for dotted-pairs with key 'key' and sets the value of the dotted pairs (if found) to 'val';

Arguments

key  key value for the dotted pair value to search for

lst  list of dotted pairs

val  new value for dotted pairs with key 'key'

Return

the input list with changed values for dotted pairs with 'key';
if there is no dotted-pair with 'key', list 'lst' returns unchanged

Example

(setq lst '((1 . "a")(2 . "b")(1 . "a")(2 . "b")))
(setq lst (vle-set-cdrassoc 1 lst "A"))
returns '((1 . "A")(2 . "b")(1 . "A")(2 . "b"))

Alias

vle-set-cassoc

Remarks

*NOT* a general replacement for (subst new old lst)
but useful replacement for : (subst new (assoc key lst) lst)



©  Bricsys NV. All rights reserved.