Module moonwalk.sugar
Syntax sugar.
Functions
| sweeten (fn, argc) | Sweeten a function. |
Functions
- sweeten (fn, argc)
-
Sweeten a function. This effectively allows functions taking multiple
arguments to be "called without parentheses." You probably don't need
to use this.
method,
argcshould include the hiddenselfargument.If the wrapper is called with less than
argcarguments, it will return a continuation object that can be called or concatenated with any remaining arguments. Otherwise, it will tail-callfnand return the result.Parameters:
- fn A function taking a fixed number of non-optional arguments.
- argc
The number of arguments
fntakes. Iffnis a table
Returns:
-
A wrapper function for
fn.