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