container_functions(7) | container_functions(7) |
container_functions - container functions
CFL container functions accepting placeholders and containers.
A container function in CFL accepts placeholders and future containers as
arguments. There is no need to call bind
for partial function application or
composition.
Regular functions can be adapted to container functions using cfn
.
auto f = cfn ([] (int a, int b) { return a + b; });
auto g = f (1_r, 2);
g (1) == 3;
Also, regular functions can be invoked so to accept placeholders and future
containers using cinvoke
.
auto f = [] (int a, int b) { return a + b; };
assert (cinvoke (f, 1__, 2) (1) == 3);
If a CFL function is container or not, is specified in their manual page under the STANDARDS section. In general, functions are container when it makes sense.
This makes it easy to compose functions and write genric code, independent of arguments being placeholders or future containers. The drawback is increased compilation times, but the rationale for this choice is to decrease development time.