The function matching is based on the definition of the file in F#:
let f2 x y = x + y
let value5 = f2 10 20
let value = f2(10, 20) <-- Error
let f3 (x, y) = x + y
let value6 = f3(10, 20)
let value = f3 10 20 <-- Error
However, I can use in both ways with one parameter with F#:
let f n = n + 10
let value3 = f 10
let value4 = f(10)
Why is this? Does F# treat parameter matching differently when there is only one input parameter?
As ashays correctly explains, the two ways of declaring functions are different. You can see that by looking at the type signature. Here is an F# interactive session:
The first function takes a tuple of type
int * intand returnsint. When calling it, you need to specify the tuple (which is just a single value):The type of the second function is
int -> int -> int, which is the same thing asint -> (int -> int). This means that it is a function that takesintand returns a function that takesintand returnsint. This form is called curried form and it allows you to use partial function application as demonstrated by ashays. In fact, the call: