Skip to content

Instantly share code, notes, and snippets.

@notyy
Created January 5, 2012 15:16
Show Gist options
  • Save notyy/1565673 to your computer and use it in GitHub Desktop.
Save notyy/1565673 to your computer and use it in GitHub Desktop.
compolse
def m2(x:Int) = x * 2
def p1(x:Int) = x + 1
scala> (1 to 5).map(m2).map(p1)
res3: scala.collection.immutable.IndexedSeq[Int] = Vector(3, 5, 7, 9, 11)
scala> (1 to 5).map(m2 _ andThen p1)
res9: scala.collection.immutable.IndexedSeq[Int] = Vector(3, 5, 7, 9, 11)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment