put
put a value into a dict or list
(any xs, any key, any value) -> any
If xs
is a dict or list, returns the same type of collection with xs[key]
set to value
.
Returns nil
if xs
is nil
or key
is nil
.
Throws an error if xs
is not a list or dict.
Parameters
Name | Type | Description |
---|---|---|
xs |
dict or list | The dict or list to modify |
key |
string or long | The key or index to use |
value |
any |
The value to place into xs |