Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created March 18, 2015 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shigemk2/90d6092764e8be9b86be to your computer and use it in GitHub Desktop.
Save shigemk2/90d6092764e8be9b86be to your computer and use it in GitHub Desktop.
val add10 = (n:Int) => n + 10
val mult2 = (n:Int) => n * 2
val addxy = (x:Int,y:Int) => x + y
println(add10.andThen(mult2)(1))
println(add10.compose(mult2)(1))
// println(addxy.andThen(mult2)(1)(2))
// println(mult2.compose(addxy)(1)(2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment