Last active
August 29, 2015 14:25
-
-
Save nepalez/7f2810b948d6b2e2f173 to your computer and use it in GitHub Desktop.
ruby challenges
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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