nreplace, nreplace_equal
nreplace,
nreplace_equal — replace elements in a list.
nreplace (new_s_exp, old_s_exp, list)
nreplace_equal (new_s_exp, old_s_exp, list)
new_s_expThe new expression to be inserted into the list.
old_s_expThe expression in the list to be replaced.
listA list.
The list, with all occurrences of
old_s_exp destructively replaced by
new_s_exp.
nreplace traverses the list,
replacing any element which is eq to
old_s_exp with new_s_exp.
nreplace_equal uses equal as
its comparison function.
Gamma>R = list (#f, nil, 5, #ftg);(f nil 5 ftg)Gamma>nreplace(#h, #ftg, R);(f nil 5 h)Gamma>x = list(1,2,3,1,6,7);(1 2 3 1 6 7)Gamma>nreplace(4,1,x);(1 2 3 1 6 7)Gamma>nreplace_equal(4,1,x);(4 2 3 4 6 7)Gamma>x;(4 2 3 4 6 7)Gamma>