Skip to content

Instantly share code, notes, and snippets.

@justincbeck
Created September 15, 2011 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justincbeck/1219065 to your computer and use it in GitHub Desktop.
Save justincbeck/1219065 to your computer and use it in GitHub Desktop.
Ruby, or is it?
Factorial = (n) {
(y,f) { y.(f).(n) }.(
(le) {
(f) { f.(f) }.(
(f) {
le.(->(x) { f.(f).(x) })
})
},
(recurse) {
(n) { (n==0) ? 1 : n * recurse.(n-1) }
})
}
p Factorial.(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment