Sum(4)(5) = 9 //JavaScript
webuiarchitect.com
webuiarchitect.com
At least 21, listed at http://www.paulgraham.com/accgen.html solving a problem that contains this one.
>>> def sum(x):
... return lambda y: x + y
...
>>> sum(4)(5)
9
user=> (defn sum [x] #(+ % x))
#'user/sum
user=> ((sum 4) 5)
9 Func<int, int> Sum(int x)
{
return (Func<int, int>)((y) => x + y);
}
var z = Sum(4)(5);Func<int, int> Sum(int x) { return y => x + y; }
public static interface a
{
public int a( int a );
}
public static a sum( final int n )
{
return new a() { public int a( int a ) { return a + n; } };
}
public static void main( String[] args )
{
System.out.println( sum( 3 ).a( 5 ) );
} function math(input_func){
return function(first_input){
return function(second_input){
return input_func(first_input, second_input)
}
}
}
function add(a, b){
return a + b;
}
function subtract(a, b){
return a - b;
}
alert math(add)(4)(5);
alert math(subtract)(4)(5);
Hooray for lexical closures!http://dankogai.typepad.com/blog/2006/03/lambda_calculus.htm...