Reputation: 34071
I have a function
//normal version
let addTwoParameters x y =
x + y
translate to curry version it looks like:
//explicitly curried version
let addTwoParameters x = // only one parameter!
let subFunction y =
x + y // new function with one param
subFunction // return the subfunction
What when I have a function with 4 arguments like:
let addTwoParameters a b c d =
a + b + c + d
How the currying version would be?
Upvotes: 0
Views: 68
Reputation: 599
It would look like this:
let addTwoParameters a =
let subFunction1 b =
let subFuction2 c =
let subFuction3 d =
a + b + c + d
subFuction3
subFuction2
subFunction1
Upvotes: 2