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

fix: add Zip and ZipWith to iterators

Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
Dr. Carsten Leue
2023-08-03 13:27:41 +02:00
parent 89265eed7c
commit e4fd34a6b5
27 changed files with 11663 additions and 11035 deletions

View File

@@ -19,14 +19,11 @@ type (
// RecFct is the function called recursively
RecFct[T, R any] func(T) R
// transformer
Transformer[T, R any] func(RecFct[T, R]) RecFct[T, R]
internalCombinator[T, R any] func(internalCombinator[T, R]) RecFct[T, R]
)
// Y is the Y-combinator based on https://dreamsongs.com/Files/WhyOfY.pdf
func Y[T, R any](f Transformer[T, R]) RecFct[T, R] {
func Y[TRFRM ~func(RecFct[T, R]) RecFct[T, R], T, R any](f TRFRM) RecFct[T, R] {
g := func(h internalCombinator[T, R]) RecFct[T, R] {
return func(t T) R {
return f(h(h))(t)