I'm currently following Functional Programming In Scala
This is the psuedo-implementation of apply
in List[A]
def apply[A](as: A*): List[A] =
if (as.isEmpty) Nil
else ::(as.head, apply(as.tail: _*))
If I omit : _*
in as.tail: _*
, scala complains for type mismatch, which makes sense since as.tail
is Seq[A]
here.
But what does _*
exactly do here?
Edit::
Correct terminology for such is sequence wildcard