Iteration methods (especially map and filter) could be much simpler with the introduction of local functions. A local function can read the surrounding function's context, but defines its own arguments and variables. Its variable may shadow the surrounding function's variables.
Iteration methods (especially
map
andfilter
) could be much simpler with the introduction of local functions. A local function can read the surrounding function's context, but defines its own arguments and variables. Its variable may shadow the surrounding function's variables.An example from
pox-2
:Combining local functions and a range function (https://github.com/clarity-lang/reference/issues/50):
Note how much of the fold accumulator is dedicated just to marshaling local variables to the iteration.