Core concept
List(1, 2, 3).map(_ * 2)
def apply(f: Int => Int, x: Int) = f(x)Advertisement
How it works
Function objects allocate. Optimizer often inlines.
Advertisement
Trade-offs + gotchas
Everywhere. Idiomatic Scala.
List(1, 2, 3).map(_ * 2)
def apply(f: Int => Int, x: Int) = f(x)Function objects allocate. Optimizer often inlines.
Everywhere. Idiomatic Scala.