title: Scala: Unpacking tuple as part of argument list
body: <p>I am trying to send the result of a method call's tuple, as <strong>part</strong> of the argument list for another method. </p>
  
  <p>Target method</p>
  
  <pre><code>def printResult(title: String, result: Int, startTime: Long, endTime: Long)
  </code></pre>
  
  <p>Return from method, partial argument list</p>
  
  <pre><code>def sendAndReceive(send: Array[Byte]): (Int, Long, Long)
  </code></pre>
  
  <hr>
  
  <p>In other words, I am trying to call <code>printResult(String, (Int, Long, Long))</code>. If the method return signature matches the method call, then I could have used</p>
  
  <pre><code>(printResult _).tupled(sendAndReceive(heartbeat))
  </code></pre>
  
  <p>This results in syntax error</p>
  
  <pre><code>printresult("Hi", Function.tupled(sendAndReceive(heartbeat))
  </code></pre>
  
  <h2>Workaround</h2>
  
  <p>I am resorting to manually unpacking the tuple, then using it when calling the method</p>
  
  <pre><code>val tuple = sendAndReceive(heartbeat)
  printResult("Heartbeat only", tuple._1, tuple._2, tuple._3)
  </code></pre>
  
  <p>Is there a more elegant way to unpack and send a tuple as part of argument list?</p>
  
  <h2>References</h2>
  
  <p><a href="https://stackoverflow.com/questions/11615656/scala-decomposing-tuples-in-function-arguments">Scala: Decomposing tuples in function arguments</a></p>
  
  <p><a href="https://stackoverflow.com/questions/6322436/invoke-a-method-using-a-tuple-as-the-parameter-list">Invoke a method using a tuple as the parameter list</a></p>
  
  <p><a href="https://stackoverflow.com/questions/6399824/will-tuple-unpacking-be-directly-supported-in-parameter-lists-in-scala">Will tuple unpacking be directly supported in parameter lists in Scala?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/6905207/tuple-unpacking-in-map-operations">Tuple Unpacking in Map Operations</a></p>