Skip to content

Instantly share code, notes, and snippets.

@nepalez
Last active August 29, 2015 14:25
Show Gist options
  • Save nepalez/7f2810b948d6b2e2f173 to your computer and use it in GitHub Desktop.
Save nepalez/7f2810b948d6b2e2f173 to your computer and use it in GitHub Desktop.
ruby challenges
# identity
id = -> v { v }
# composition
composition = -> g, f { -> v { g[f[v]] } }
# testing for id
g = -> v { v * 2 }
composition(g, id)[3] == g[3] # true
composition(id, g)[3] == g[3] # true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment