I am well-versed in using the >>
and <<
operators in F#. However, after looking in the F# source to establish a deeper understanding I became confused with this:
let inline (>>) f g x = g(f x)
let inline (<<) f g x = f(g x)
How do I interpret these expressions conceptually? Also, how would you describe these expressions? Are they defining a type?
As the msdn page for F# functions says,
Functions in F# can be composed from other functions. The composition of two functions
function1
andfunction2
is another function that represents the application offunction1
followed the application offunction2
.
It can be thought of as similar to the pipe operators, just without specifying the last/deepest parameter; e.g. the following two lines are equivalent:
let composed = f >> g
let piped x = g <| f x
Also see this question for more information.