Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

F# piping a quadruple to a function

Tags:

f#

A tuple is piped by:

let a = (1,2)
let f a b = ()
a ||> f

A triple is piped by:

let a = (1,2,3)
let f a b c = ()
a |||> f

But this doesn't work for a quadruple:

let a = (1,2,3,4)
let f a b c d= ()
a ||||> f

How do you pipe a quadruple to a function?

like image 996
Paul Nikonowicz Avatar asked Dec 07 '22 15:12

Paul Nikonowicz


1 Answers

The others are defined by F#, for a 4-tuple you need to define it yourself:

let a = (1,2,3,4)
let f a b c d = printfn "got %A %A %A %A" a b c d

let inline (||||>) (a,b,c,d) f = f a b c d

a ||||> f
like image 159
yamen Avatar answered Dec 15 '22 03:12

yamen