I was reading this article by Tomas Petricek, and it mentioned the pipelining |> as in the example given:
> let nums = [1; 2; 3; 4; 5];;
val nums : list<int>
> let odds_plus_ten =
nums
|> List.filter (fun n-> n%2 <> 0)
|> List.map (add 10)
val odds_plus_ten : list<int> = [11; 13; 15];;
What does pipelining mean? Initially, I thought it was akin to a CPU instruction being pipelined within the cores. Can you explain what it is and how does it work in the context of F#?
Thanks,
Best regards,
Tom.
Pipelining means passing the results of one function to another function. In the example you give “nums” is passed the List.Filter, the filtered results are then passed to List.Map.
More info here: http://msdn.microsoft.com/en-us/magazine/cc164244.aspx#S6