variable length arguments with generic types scala
<p>I have a simple abstract data type, a tree.</p>

<pre><code>sealed trait Tree[A]
case object EmptyTree extends Tree[Nothing]
case class Leaf[A](value: A) extends Tree[A]
case class Node[A](op: A =&gt; A, branches: List[Tree[A]]) extends Tree[A]
</code></pre>

<p>How can i make the operation that a <code>Node</code> holds to accept a variable length number of arguments of type A?</p>

<p>An exemple:</p>

<pre><code>def printAll(strings: String*) {
  strings.foreach(println)
}
</code></pre>

<p><code>printAll</code> receives a variable number of strings.</p>

<p>In the same way i wanted to make my Tree to hold an operation <code>op</code> of the type <code>A* =&gt; A</code>.</p>

<p>A possible way would be to make it receive a <code>List[A]</code>, but i wonder if there isn't a more direct way of doing this.</p>

<hr>

<p>by the way can i also turn <code>branches: List[Tree[A]]</code> into something like <code>branches: Tree[A]*</code>. Does this make sense from a design perspective?</p>