Skip to content

Instantly share code, notes, and snippets.

@wintercn
Last active April 3, 2019 17:52
Show Gist options
  • Save wintercn/7d06dd226d699c832b6a to your computer and use it in GitHub Desktop.
Save wintercn/7d06dd226d699c832b6a to your computer and use it in GitHub Desktop.
ycombinator in es2015
//yc here
var y = g =>
(f=>f(f))(
self =>
g( (...args)=>self(self)(...args) )
)
//use yc
var f = y(self =>
n => n < 0 ? 0 : n + self(n-1))
f(100); // 5050
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment