Currying represents a function as a sequence of single-argument functions. Supplying one argument returns a new function that accepts the next, while supplying all arguments at once remains valid. section 6.1.1 section 6.4
Build a specialized function
let add (firstNumber:int) (secondNumber:int) = firstNumber + secondNumber let addFive = add 5 let fifteen = addFive 10 Here, addFive remembers 5 and waits for the remaining number. The same pattern can specialize an email sender: let sendEmailToFred = sendEmail "fred@email.com". section 6.1.1 section 6.1.2
Currying is useful when you want to:
- Inject stable arguments once, then reuse the returned function with changing values. section 6.4
- Replace boilerplate associated with manually constructing partially configured objects or functions. section 6.1.1 section 6.1.2
- Compose naturally with pipelines and F# functions, which support partial application and full type inference. section 6.1.6 section 6.4
Listing 6.2 Calling an F# function
let add (firstNumber:int) (secondNumber:int) = #1
firstNumber + secondNumber
let addFive = add 5 #2
let fifteen = addFive 10 #3
Inspect the staged add, addFive, and fifteen calls as a compact model of incremental argument application. section 6.1.1






