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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user