Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
sample factorial y combinator in Ruby
result = -> (builder, number) { builder.call(builder, number) }.call(
-> (recurse, number) {
return 1 if number == 0
return number * recurse.call(recurse, number - 1)
},
5
)
result # => 120
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment