delete
delete an item from a dict or list
(any xs, any key) -> any
Given a list or dict xs
, returns a collection of the same type consisting of all elements of xs
, except for the element at key or index key
.
If xs
is a list, any elements past the deleted index are shifted to the left.
Returns nil
if xs
is nil
.
Retrurns xs
if xs
does not have the given key
.
Returns xs
if key
is nil
.
Throws an error if xs
is a list and key
cannot be cast to a long.
Throws an error if xs
is a dict and key
cannot be cast to a string.
Parameters
Name | Type | Description |
---|---|---|
xs |
dict or list | The dict or list to modify |
key |
string or long | The key or index to delete |