Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

F# currying - calling with two parameters

Tags:

currying

f#

I have problem, that can be reduced to following example:

let func a b c = printf "%s %s %s" a b c
let partial = func "a"

let something_that_returns_two_parameters = "b", "c" // what to write here?

something_that_returns_two_parameters |> partial // what to write here?

My expected result is func being called with "a" "b" "c". I can edit last two lines. Is this achievable in some way?

like image 505
nothrow Avatar asked Feb 06 '23 08:02

nothrow


1 Answers

You need to apply the tuple using the ||> operator:

something_that_returns_two_parameters ||> partial

This operator applies each component of the tuple to the function.

See F# operators for reference.

like image 115
Gus Avatar answered Feb 07 '23 22:02

Gus