when using .net classes, there are cases when we don’t need parenthesis to pass a single parameter like
let foo = DirectoryInfo "boo"
but something a little more complicated using a single parameter, we do need parenthesis…
does anyone know the parsing rules when this is true?
In F#, all functions take a single parameter. Now this may be a little confusing at first, because you can have a function which appears to take more than one parameter, but you’re actually passing a single parameter that is a tuple.
Here’s a simple example of constructors that appear like they take more than 1 parameter:
For more info about this style, check out Tuples on MSDN.
Now, there also is another slightly different method of making it seem like a function takes more than 1 argument. This is called currying, which you will see more often when dealing only with F# code. Here’s a quick example of this.