I mean, I know what that means: take a list and add 1 to each element in it; those. equivalently map (1 + _ ). I don't understand how Scala knows this is equivalent. What's going on here?
Edit
Daniel points out a more general question. for instance
def g(f : Int => Int, x : Int) = f(f(x))
g( (1 + ), 2)
res12: Int = 4
Which is cool. Every day, I find a new useful thing Scala can do. I guess I'm looking for a full description (and, ideally, a name) of this particular thing.
source
share