How to pass a tuple argument the best way ?
def foo(...): (Int, Int) = ...
def bar(a: Int, b: Int) = ...
val fooResult = foo(...)
n > 2
There is a special
tupled method available for every function:
val bar2 = (bar _).tupled // or Function.tupled(bar _)
bar2 takes a tuple of
(Int, Int) (same as
bar arguments). Now you can say:
If your methods were actually functions (notice the
val keyword) the syntax is much more pleasant:
val bar = (a: Int, b: Int) => //... bar.tupled(foo())