In Microsoft’s F# samples, they use the “>>” operator as follows:
test |> Seq.iter (any_to_string >> printfn "line %s");
What does the “>>” operator do in this context? Is each item of the sequence (an array in this case) get passed to any_to_string implicitly? Is this similar to (fun item -> printfn "line %A" item)?
An equivalent piece of code could be written the following way:
In other words, the >> operator simply does this: given a function f(x) returning type T and g(y) with y being of type T, you can use f >> g to create a function h(z) being equivalent to g(f(x)). No argument but the inner and outer function has to be passed to that operator and the result is a function which can be applied at any time in your code, so you could do this: