put
function:
-
Can also be called as
insert
-
Can also be called as
replace
-
Can also be called as
{}
Add a new entry to a map. The first argument should be an object. The second argument should be a key. The third argument should be a value. If the object has that key, it will be replaced.
Examples:
- running:
(put {}, "a", 1)
will give:{"a": 1}
- running:
(put {"a": 10, "b": 22}, "a", -1)
will give:{"a": -1, "b": 22}
- running:
(put [], "a", 1)
will return nothing
- running:
(put {}, 1, 1)
will return nothing
- running:
(put {}, "1", ({} {} 1 1))
will return nothing