Module crit.func_util

Utilities for working with functions.

Functions

bind (f, arg) Bind a first parameter to a function.
compose (...) Compose multiple functions.


Functions

bind (f, arg)
Bind a first parameter to a function. Returns a wrapped function with arg bound to the first parameter. Call it with the remaining parameters.

Parameters:

  • f function The function to wrap.
  • arg any The argument to bind as first argument.

Returns:

    function The wrapped function.
compose (...)
Compose multiple functions. Returns a function that chains the provided list of functions. For example, func_util.compose(f, g, h)(x) is the equivalent of f(g(h(x))).

Parameters:

  • ... function A list of functions to compose. If empty, returns the identity function.

Returns:

    function The composed function.
generated by LDoc 1.4.6 Last updated 2022-05-04 10:01:11