Map.get_lazy/3

defmodule Map do
  def get_lazy(map, key, fun)
end

Gets the value for a specific key in map.

If key is present in map with value value, then value is returned.

Otherwise, fun is evaluated and its result is returned. This is useful if the default value is very expensive to calculate or generally difficult to setup and teardown again.