Passing off a list as a tuple is not easy, because the types don't match very well (more on this later). With enough shoehorning and lubricating anything fits though:
"My hack" should {
"allow a function to be called with Lists" in {
def function(bar:String, baz:String)= bar+baz
//turn the function into something that accepts a tuple
val functionT = function _
val functionTT = functionT.tupled
val arguments = List("bar", "baz")
//Give the compiler a way to try and turn a list into a tuple of the size you need
implicit def listToTuple(args:List[String]) = args match {
case List(a, b) => (a, b)
case _ => throw IllegalArgumentException("Trying to pass off %s as a pair".format(args))
}
//Shove it in and hope for the best at runtime
val applied = functionTT(arguments)
applied === "barbaz"
}
}
You can extend this approach by adding the additional arguments to the list, or by Schönfinkeling the arguments in two different groups. I wouldn't go that way.
From my remarks you might have noticed that I don't like the design that causes this question to pop up. The code I showed is essentially code that is wrapping the function in a facade anyway. Why not do it properly?
Looking at Spray you might see that their complete method accepts a ton of different parameters implicitly. The nifty trick they've used for this they've named the Magnet Pattern. You could do the same thing and introduce implicit conversions to your magnet for different tuples you choose to accept.