Skip to content

Instantly share code, notes, and snippets.

@kalasjocke
Created March 19, 2014 21:03
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 kalasjocke/9651212 to your computer and use it in GitHub Desktop.
Save kalasjocke/9651212 to your computer and use it in GitHub Desktop.
puts ->() {
compose = ->(f, g) {
->(n) { f.(g.(n)) }
}
make_adder = ->(x) {
->(n) { n + x }
}
add1 = make_adder.(1)
add2 = make_adder.(2)
compose.(add1, add2).(3)
}.()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment