asoft
sea

~ tiny vessels of code slowly floating out to sea

Powered by a motorboat called the S.S.Tumblr

1 year ago

@12:19am

Comments

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

via Coderspiel

  1. asoftsea reblogged this from coderspiel
  2. coderspiel posted this
blog comments powered by Disqus