time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

repl.txt (1254B)


      1 
      2 {{alias}}( fcn[, arity, ][thisArg] )
      3     Transforms a curried function into a function invoked with multiple
      4     arguments.
      5 
      6     Provided arguments are applied starting from the right.
      7 
      8     Parameters
      9     ----------
     10     fcn: Function
     11         Curried function.
     12 
     13     arity: integer (optional)
     14         Number of parameters.
     15 
     16     thisArg: any (optional)
     17         Evaluation context.
     18 
     19     Returns
     20     -------
     21     out: Function
     22         Uncurried function.
     23 
     24     Examples
     25     --------
     26     > function addX( x ) {
     27     ...     return function addY( y ) {
     28     ...         return x + y;
     29     ...     };
     30     ... };
     31     > var fcn = {{alias}}( addX );
     32     > var sum = fcn( 3, 2 )
     33     5
     34 
     35     // To enforce a fixed number of parameters, provide an `arity` argument:
     36     > function add( y ) {
     37     ...     return function add( x ) {
     38     ...         return x + y;
     39     ...     };
     40     ... };
     41     > fcn = {{alias}}( add, 2 );
     42     > sum = fcn( 9 )
     43     <Error>
     44 
     45     // To specify an execution context, provide a `thisArg` argument:
     46     > function addY( y ) {
     47     ...     this.y = y;
     48     ...     return addX;
     49     ... };
     50     > function addX( x ) {
     51     ...     return x + this.y;
     52     ... };
     53     > fcn = {{alias}}( addY, {} );
     54     > sum = fcn( 3, 2 )
     55     5
     56 
     57     See Also
     58     --------
     59