A.OrdMap.pop
You're seeing just the function
pop
, go back to A.OrdMap module for more information.
Specs
Returns the value for key
and the updated ordered map without key
.
If key
is present in the ordered map with a value value
,
{value, new_ord_map}
is returned.
If key
is not present in the ordered map, {default, ord_map}
is returned.
Examples
iex> ord_map = A.OrdMap.new(a: "Ant", b: "Bat", c: "Cat")
iex> {"Bat", updated} = A.OrdMap.pop(ord_map, :b)
iex> updated
#A.OrdMap<%{a: "Ant", c: "Cat"}, sparse?: true>
iex> {nil, updated} = A.OrdMap.pop(ord_map, :z)
iex> updated
ord(%{a: "Ant", b: "Bat", c: "Cat"})
iex> {"Z", updated} = A.OrdMap.pop(ord_map, :z, "Z")
iex> updated
ord(%{a: "Ant", b: "Bat", c: "Cat"})