Last active
August 14, 2023 07:57
-
-
Save th507/9298e318b94171ad14754c6cb4b6983a to your computer and use it in GitHub Desktop.
3 different form of fixed point combinators
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Y is the fixed point combinator. w1, w2, w3 are its building block. | |
// one level deep | |
var w1 = f => n => f( w1(f) )(n) | |
var Y = w1 | |
// two level deep | |
var w2 = g => f => n => f( g(g)(f) )(n) | |
var Y = w2(w2) | |
// three level | |
var w3 = g => h => f => n => f( g(h)(g)(f) )(n) // g, h can be in arbitrary order | |
var Y = w3(w3)(w3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment