I suppose you come from Haskell, for expecting it to work this way :)
Unfortunately, F# doesn't have the syntactic sugar where you can partially apply an operator by parenthesizing it preceded or followed by an expression. In your code, +1
is considered a single number token, which is why it complains that it is not a function.
What F# does have, however, is the syntax where you can parenthesize the operator alone. Which leads to @Lee's solution. Be careful about this syntax though: (+) 1
is equivalent to Haskell's (1+)
, not (+1)
. Obviously for addition it doesn't matter, but for asymmetrical operations such as subtraction, it can be misleading.