(s: S, max: number, f: (s: S, input: In) => S)
| 1070 | |
| 1071 | /** @internal */ |
| 1072 | export const foldUntil = <S, In>(s: S, max: number, f: (s: S, input: In) => S): Sink.Sink<S, In, In> => |
| 1073 | pipe( |
| 1074 | fold<[S, number], In>( |
| 1075 | [s, 0], |
| 1076 | (tuple) => tuple[1] < max, |
| 1077 | ([output, count], input) => [f(output, input), count + 1] |
| 1078 | ), |
| 1079 | map((tuple) => tuple[0]) |
| 1080 | ) |
| 1081 | |
| 1082 | /** @internal */ |
| 1083 | export const foldUntilEffect = <S, In, E, R>( |