When defining parameters in F # functions, is it better to use tuples?

A simple question ... Is it good practice to define a function that takes more than one parameter through tuples?

I explain myself better: I have a function:

let myfunc par1 par2 = ...;;

Is it good?

let myfunc (par1, par2) = ...;;

When I say "this is good," I say: is this a good practice? is it good to ALWAYS do this as the usual practice of passing function parameters?

thank

+5
source share
1 answer

The usual F # style is for defining functions performed in curry, i.e. not alternating according to your first example.

Currying allows you to do this: ("partial application")

let myfunc par1 par2 = ...
let myfuncHello = myfunc "Hello"
myfuncHello "World" // same as: myfunc "Hello" "World"

, .NET, F #, tupling, , F #.

: F # Snippets: http://fssnip.net/I

+5

All Articles