I am using the following code to meet my needs:
(1 to 5)..map(i => s"\\x${i}") // Produces List("\\x1", "\\x2", "\\x3", "\\x4", "\\x5")
But I would like to use a placeholder. According to the string interpolator documentation :
(1 to 5).map(s"\\x${_}")
should expand to:
(1 to 5).map(StringContext("\\\\x","").s(_))
But the latter works, not the former, which throws an error: unbound placeholder parameter
on _
. Why?