March 2012
1 post
Some ways to write function literals in Scala
coderspiel:
Just cuz iheardata asked and I can’t find a set of examples I like.
(i: Int) => i + 1
{ (i) => i + 1 } : (Int => Int)
( (i) => i + 1 ) : (Int => Int)
{ i => i + 1 } : (Int => Int)
( i => i + 1 ) : (Int => Int)
{ _ + 1 } : (Int => Int)
( _ + 1 ) : (Int => Int)
(_: Int) + 1