Gcode.Result.Enum (gcode v1.0.0)

Common enumerableish functions on results.

Link to this section Summary

Functions

Join the string contents of an ok result.

Maps a collection of results using a mapping function.

As long as the result of the reducer is ok, continue reducing, otherwise short circuit

Reverse the enumerable contents of an ok result.

Link to this section Types

@type result() :: Gcode.Result.t()
Link to this type

result(result)

@type result(result) :: Gcode.Result.t(result)
Link to this type

result(result, error)

@type result(result, error) :: Gcode.Result.t(result, error)

Link to this section Functions

Link to this function

join(arg, joiner)

@spec join(result([String.t()]), String.t()) :: result(String.t())

Join the string contents of an ok result.

Link to this function

map(arg, mapper)

@spec map(result([any()]), mapper :: (any() -> result(any()))) :: result([any()])

Maps a collection of results using a mapping function.

Both the input to the map must be an ok result and the result of each mapping function.

Link to this function

reduce_while_ok(elements, acc, reducer)

@spec reduce_while_ok(
  enumerable :: any(),
  accumulator :: any(),
  reducer :: (any(), any() -> result(any()))
) :: result(any())

As long as the result of the reducer is ok, continue reducing, otherwise short circuit

@spec reverse(result([any()])) :: result([any()])

Reverse the enumerable contents of an ok result.