Skip to content

Instantly share code, notes, and snippets.

@diegopacheco
Created August 11, 2014 00:34
Show Gist options
  • Save diegopacheco/b1b22e896eccd951c88a to your computer and use it in GitHub Desktop.
Save diegopacheco/b1b22e896eccd951c88a to your computer and use it in GitHub Desktop.
andThen Scala
scala> val doubleit = (i:Int) => i *2
doubleit: Int => Int = <function1>
scala> val doublePlus2 = doubleit andThen ( i => i + 2)
doublePlus2: Int => Int = <function1>
scala> doublePlus2(2)
res0: Int = 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment