maps lists
Since v1.0.0
Available on all platforms
See also

Removes an entry from a MAP or from a LIST.

The REMOVE function consumes a list (or a map) and a index (or a key), then remove the entry. It lets the input on the stack and puts the removed item on top of the stack. As a result, the input map or list is modified and the map or list left on top of the stack is not a copy.

If the index is greater than the size list, it raises an error. If the key does not exist in the map, it returns null as the removed entry.



//LIST examples [ 'apple' 'banana' 'orange' ] 'mylist' STORE $mylist 1 REMOVE //$mylist 2 REMOVE //try to uncomment this line (error!) '' //remove two first items [ 'item01' 'item02' 'item03' 'item04' 'item05' ] 0 REMOVE SWAP 0 REMOVE SWAP '' //remove the last item [ 'item01' 'item02' 'item03' 'item04' 'item05' ] DUP //SIZE will replace the TOP of the stack SIZE 1 - // list size - 1 REMOVE DROP //don t want to keep 'item05' on the TOP of the stack
{ 'label0' 42 'label1' 'foo' 'label2' true } 'mymap' STORE $mymap 'label1' REMOVE $mymap 'notalabel' REMOVE