InductiveGraph.Utilities (InductiveGraph v0.1.0) View Source

Functions for use by other modules.

Link to this section Summary

Functions

Updates value at key in map by function.

Updates element at position in tuple by function.

Link to this section Functions

Link to this function

map_update(map, key, function)

View Source

Specs

map_update(map(), Map.key(), (Map.value() -> Map.value())) ::
  {:ok, map()} | :error

Updates value at key in map by function.

If key is present in map with value value, then {:ok, new_map} is returned where new_map is equivalent map with the result of function with argument value as the new value for key. Otherwise, :error is returned.

Link to this function

tuple_update_position!(tuple, position, function)

View Source

Specs

tuple_update_position!(tuple(), non_neg_integer(), (term() -> term())) ::
  tuple()

Updates element at position in tuple by function.