The F# pipe operator (|>) passes the value on its left to the last argument of the function on its right. It lets data flow through a readable sequence of transformations. section 6.1.3
Use the pipe operator to remove temporary variables and avoid reversing the conceptual flow with nested calls:
- Direct call: addFive 10 becomes 10 |> addFive. section 6.1.3
- Multiple transformations can be chained when one function’s output matches the next function’s input. section 6.1.3
- Pipelines can be formatted on one line or across multiple lines. section 6.1.3
A small numeric pipeline
let pipelineMultiline = 10 |> add 5 |> add 7 |> multiply 2 This expresses the same calculation as nested calls, but follows the value from left to right. section 6.1.3
Listing 6.4 Chaining function calls using the pipeline operator
let pipelineSingleLine = 10 |> add 5 |> add 7 |> multiply 2 #1
let pipelineMultiline = #2
10
|> add 5
|> add 7
|> multiply 2
Compare single-line and multiline pipeline syntax in a complete F# listing. section 6.1.3





