Skip to content

Instantly share code, notes, and snippets.

@nepalez

nepalez/ruby_challenges.rb

Last active Aug 29, 2015
Embed
What would you like to do?
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