List.keyfind
You're seeing just the function
keyfind
, go back to List module for more information.
Specs
keyfind([tuple()], any(), non_neg_integer(), any()) :: any()
Receives a list of tuples and returns the first tuple
where the element at position
in the tuple matches the
given key
.
If no matching tuple is found, default
is returned.
Examples
iex> List.keyfind([a: 1, b: 2], :a, 0)
{:a, 1}
iex> List.keyfind([a: 1, b: 2], 2, 1)
{:b, 2}
iex> List.keyfind([a: 1, b: 2], :c, 0)
nil