1
0
mirror of https://github.com/IBM/fp-go.git synced 2025-11-25 22:21:49 +02:00

fix: name the endomorphism for the Y combinator

Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
Dr. Carsten Leue
2023-12-22 14:41:55 +01:00
parent 973138c822
commit 36eefbcd27
2 changed files with 9 additions and 3 deletions

View File

@@ -16,11 +16,11 @@
package lambda
// Y is the Y-combinator based on https://dreamsongs.com/Files/WhyOfY.pdf
func Y[TRFRM ~func(RecFct) RecFct, RecFct ~func(T) R, T, R any](f TRFRM) RecFct {
func Y[Endo ~func(RecFct) RecFct, RecFct ~func(T) R, T, R any](f Endo) RecFct {
type internalCombinator[RecFct ~func(T) R, T, R any] func(internalCombinator[RecFct, T, R]) RecFct
type internal[RecFct ~func(T) R, T, R any] func(internal[RecFct, T, R]) RecFct
g := func(h internalCombinator[RecFct, T, R]) RecFct {
g := func(h internal[RecFct, T, R]) RecFct {
return func(t T) R {
return f(h(h))(t)
}