Skip to content

Instantly share code, notes, and snippets.

@ZenLiuCN
Created January 21, 2025 16:04
Show Gist options
  • Save ZenLiuCN/1344edc3aac077eca31f1a0918d321f4 to your computer and use it in GitHub Desktop.
Save ZenLiuCN/1344edc3aac077eca31f1a0918d321f4 to your computer and use it in GitHub Desktop.
functions
const Y=fn => (u => u(u))(x => fn((...args) => x(x)(...args)));
const factorial=Y(fa => n => n <= 1? 1: n * fa(n - 1));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment