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