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,
argc
should include the hiddenself
argument.If the wrapper is called with less than
argc
arguments, it will return a continuation object that can be called or concatenated with any remaining arguments. Otherwise, it will tail-callfn
and return the result.Parameters:
- fn A function taking a fixed number of non-optional arguments.
- argc
The number of arguments
fn
takes. Iffn
is a table
Returns:
-
A wrapper function for
fn
.