Created
August 11, 2017 21:19
-
-
Save ninjarobot/30674d31121105bfb0126904e57689af to your computer and use it in GitHub Desktop.
F# currying example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let add2 num1 num2 = | |
num1 + num2 | |
// The compiler will do this: | |
let addTwo num1 = | |
fun num2 -> | |
num1 + num2 | |
// Both functions work the same, but the curried form accepts a single parameter and returns a function that accepts another parameter. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment