time-to-botec

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

repl.txt (1226B)


      1 
      2 {{alias}}( fcn[, arity][, thisArg] )
      3     Transforms a function into a sequence of functions each accepting a single
      4     argument.
      5 
      6     Until return value resolution, each invocation returns a new partially
      7     applied curry function.
      8 
      9     This function applies arguments starting from the right.
     10 
     11     Parameters
     12     ----------
     13     fcn: Function
     14         Function to curry.
     15 
     16     arity: integer (optional)
     17         Number of parameters. Default: `fcn.length`.
     18 
     19     thisArg: any (optional)
     20         Evaluation context.
     21 
     22     Returns
     23     -------
     24     out: Function
     25         Curry function.
     26 
     27     Examples
     28     --------
     29     > function add( x, y ) { return x + y; };
     30     > var f = {{alias}}( add );
     31     > var sum = f( 2 )( 3 )
     32     5
     33 
     34     // Supply arity:
     35     > function add() { return arguments[ 0 ] + arguments[ 1 ]; };
     36     > f = {{alias}}( add, 2 );
     37     > sum = f( 2 )( 3 )
     38     5
     39 
     40     // Provide function context:
     41     > var obj = {
     42     ...     'name': 'Ada',
     43     ...     'greet': function greet( word1, word2 ) {
     44     ...         return word1 + ' ' + word2 + ', ' + this.name + '!'
     45     ...     }
     46     ... };
     47     > f = {{alias}}( obj.greet, obj );
     48     > var str = f( 'there' )( 'Hello' )
     49     'Hello there, Ada!'
     50 
     51     See Also
     52     --------
     53