[back]

Curry

Implement the function

val curry : (('a * 'b) -> 'c) -> 'a -> 'b -> 'c

which converts a "two-argument" function (i.e., a function that takes a tuple as an argument) into nested single-argument functions.

Examples

let f (x, y) = x + y
let g = curry f
let _ = assert (g 2 3 = 5)