HTML Utilities

Showing help on 'setremove()'

Syntax: setadd (LIST <list>, <value>) => LIST
setremove (LIST <list>, <value>) => LIST

Returns a copy of <list> with the given <value> added or removed, as appropriate. `Setadd()' only adds <value> if it is not already an element of <list>; <list> is thus treated as a mathematical set. <value> is added at the end of the resulting list, if at all. Similarly, `setremove()' returns a list identical to <list> if <value> is not an element. If <value> appears more than once in <list>, only the first occurrence is removed in the returned copy.

setadd({1, 2, 3}, 3) => {1, 2, 3}
setadd({1, 2, 3}, 4) => {1, 2, 3, 4}
setremove({1, 2, 3}, 3) => {1, 2}
setremove({1, 2, 3}, 4) => {1, 2, 3}
setremove({1, 2, 3, 2}, 2) => {1, 3, 2}



-- telnet://project-mongoose.net:7777 -- Mail us -- http://project-mongoose.net:7780/ --
-- Five users connected --