Replacefirst Function Example
Action
Replacefirst surgically replaces the first item in a list with a new item. For example Given the lists:
(1) (2)
X Y
* *
/ \ / \
A * F *
/ \ / \
B () G ()
with value[X] = (A B) and value[Y] = (F G) then
Replacefirst(X,Y)
has the effect of replacing the First item of the list X with the item Y.
The result is to change the value of X to ( ( F G) B )
(1)
X
*
/ \
* *
/ \ / \
F * B ()
/ \
G ()