antikythera v0.2.0 Antikythera.EnumUtil View Source

Utility functions to work with enumerables.

Link to this section Summary

Functions

Updates items of an enumerable with the given function, depending on context. Context can be any

Link to this section Types

Link to this section Functions

Link to this function map_with_context(e, c, fun) View Source
map_with_context(Enum.t(), context(), (item(), context() -> {item(), context()})) :: [item()]

Updates items of an enumerable with the given function, depending on context. Context can be any.

The function fun takes item and context as arguments, and must achieve 2 purposes:

  1. Update an item according to current context
  2. Produces new context for next item

then, return both as tuple {new_item, new_context}.