Skip to content

Instantly share code, notes, and snippets.

@palladin
Created July 28, 2021 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save palladin/d5f0a5cef2773afdf1a161207764feee to your computer and use it in GitHub Desktop.
Save palladin/d5f0a5cef2773afdf1a161207764feee to your computer and use it in GitHub Desktop.
Know thyself
let fact = `(f => n => (n === 0) ? 1 : n * f(n - 1))`
function Y(g : string) : (any) => any {
let f = `(f => ${g}(x => eval(f)(f)(x)))`
return eval(f)(f)
}
console.log(Y(fact)(10))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment