Skip to content

Instantly share code, notes, and snippets.

@ukoloff
Last active April 12, 2019 06:16
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 ukoloff/0be20ecfeb04744fce3740693dc246bd to your computer and use it in GitHub Desktop.
Save ukoloff/0be20ecfeb04744fce3740693dc246bd to your computer and use it in GitHub Desktop.
Z-combinator
//
// Z-combinator
// https://habr.com/ru/post/322052/
//
const Z = f => (f => f(f))(z => f(x => z(z)(x)))
@ukoloff
Copy link
Author

ukoloff commented Mar 25, 2019

Z(fn => i => i < 2 ? 1 : i * fn(i - 1))(10)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment