What is :_* and How it implement in Scala?

scala, symbols

Solution

It is only a syntactic sugar to indicates to the compiler that you already provide a sequence of elements, there is no other "implementation" of it. For more information, you can refer to the Scala Language Specification (§6.6, p. 78)

Problem

What i know: ``` scala> def fx(s: String *) = s.foreach(println) fx: (s: String*)Unit scala> val lst = List("1","2","3") lst: List[java.lang.String] = List(1, 2, 3) scala> fx(lst:_*) 1 2 3 ``` What i want to know: - How can I implement `:_*`? by map? - Is there any other way that replace it? - How :_* defined in Scala? Thank you

Original source