Keyword.get_lazy/3
defmodule Keyword do
def get_lazy(keywords, key, fun)
end
Gets the value for a specific key
.
If duplicated entries exist, the first one is returned.
If key
does not exist, lazily evaluates fun and returns its result.
This is useful if the default value is very expensive to calculate or generally difficult to setup and teardown again.