I am trying to wrap my head around using underscore in function literals and the following has me stumped:
The following works:
def g(s: Int => Int) = 1.to(10).map(s(_))
g(_ * 2)
but this fails:
import scala.xml.Node
def f(s: Int => Node) = 1.to(10).map(s(_))
f(<p>{_}</p>)
The error being reported is:
Error:(11, 8) unbound placeholder parameter
f(<P>{_}</P>)
^
What explains this?