F # does not contain some of the basic functions available in Haskell (mainly because F # programmers usually prefer an explicit programming style and use the pointfree style only in the most obvious cases where this does not impair readability).
However, you can define several basic combinators, for example:
Now you can implement a function to add the lengths of two lines using combinators as follows:
let addLengths = uncurry (( (first String.length) >> (second String.length) ) >> (curry (+)))
This creates two functions that apply String.length to the first / second element of the tuple, then writes them, and then adds the elements of the tuple with + . All this is wrapped in uncurry , so you get a function like string -> string -> int .
Tomas petricek
source share