Functions Documentation
View Function Edit Function
Name lnkReplace
Syntax (lnkReplace list index item) -> list
Argument List list: The list in which you want to replace an element.
index: The position of the item in the list which you want to replace with a new item.
item: The item you want to place at `index'
Returns A list with the element at `index' replaced with the `item'.
Category list
Description Replaces a element at `index' and returns the resultant list. It also modifies the list in place.
(lnkReplace '(a b c d) 2 'e) -> (a b e d)
Modifying the list in place:
(setq l '(a b))
(lnkReplace l 0 'b)
l -> (b b)
Comment Very useful list function allowing you to change individual elements.
This function CANNOT take itself as an argument, ie no nesting (lnkReplace (lnkReplace list index item) index2 item2). This means replacing multiple elements in a list requires multiple (setq list (lnkReplace list index item)) statements in a row.