This module provides functions for compile time function composition. These
functions are helpful when constructing predicates for the algorithms in
std.algorithm or
std.range.
Join a couple of functions into one that executes the original
functions one after the other, using one function's result for the next
function's argument.
Memoizes a function so as to avoid repeated
computation. The memoization structure is a hash table keyed by a
tuple of the function's arguments. There is a speed gain if the
function is repeatedly called with the same arguments and is more
expensive than a hash table lookup. For more information on memoization, refer to this book chapter.
Takes multiple functions and adjoins them together. The result is a
std.typecons.Tuple with one element per passed-in function. Upon
invocation, the returned tuple is the adjoined results of all
functions.
Transforms a string representing an expression into a binary function. The
string must either use symbol names a and b as the parameters or
provide the symbols via the parm1Name and parm2Name arguments.
If fun is not a string, binaryFun aliases itself away to
fun.
Composes passed-in functions fun[0], fun[1], ... returning a
function f(x) that in turn returns fun[0](fun[1](...(x))).... Each function can be a regular
functions, a delegate, or a string.
Transforms a string representing an expression into a unary
function. The string must either use symbol name a as
the parameter or provide the symbol via the parmName argument.
If fun is not a string, unaryFun aliases itself away to fun.
Takes multiple functions and adjoins them together. The result is a
std.typecons.Tuple with one element per passed-in function. Upon
invocation, the returned tuple is the adjoined results of all
functions.
Pipes functions in sequence. Offers the same functionality as compose, but with functions specified in reverse order. This may
lead to more readable code in some situation because the order of
execution is the same as lexical order.