List.keystore
You're seeing just the function
keystore
, go back to List module for more information.
Specs
keystore([tuple()], any(), non_neg_integer(), tuple()) :: [tuple(), ...]
Receives a list
of tuples and replaces the element
identified by key
at position
with new_tuple
.
If the element does not exist, it is added to the end of the list
.
Examples
iex> List.keystore([a: 1, b: 2], :a, 0, {:a, 3})
[a: 3, b: 2]
iex> List.keystore([a: 1, b: 2], :c, 0, {:c, 3})
[a: 1, b: 2, c: 3]