Keyword.pop_lazy
You're seeing just the function
pop_lazy
, go back to Keyword module for more information.
Specs
Lazily returns and removes all values associated with key
in the keyword list.
This is useful if the default value is very expensive to calculate or generally difficult to setup and teardown again.
All duplicated keys are removed. See pop_first/3
for
removing only the first entry.
Examples
iex> keyword = [a: 1]
iex> fun = fn ->
...> # some expensive operation here
...> 13
...> end
iex> Keyword.pop_lazy(keyword, :a, fun)
{1, []}
iex> Keyword.pop_lazy(keyword, :b, fun)
{13, [a: 1]}