[back]

Curry 3

Implement the function

val curry3 : ('a * 'b * 'c -> 'd) -> 'a -> 'b -> 'c -> 'd

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

Examples

let f (x, y, z) = x + y + z
let g = curry3 f
let _ = assert (g 1 2 3 = 6)