[ create a new paste ] login | about

Link: http://codepad.org/ehx2wgVf    [ raw code | output | fork ]

nepta - Lua, pasted on Apr 7:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function curry2(f)
   return function(a)
      return function(b)
         return f(a,b)
      end
   end
end

function add(a,b)
   return a + b
end

local curryAdd = curry2(add)
local add2 = curryAdd(2)

print(add2(3))
print(add2(4))
print(curryAdd(4)(2))


Output:
1
2
3
5
6
6


Create a new paste based on this one


Comments: