// ets_tracing: off import * as T from "../../../../Effect/index.js" import type * as C from "../core.js" import * as ScanEffect from "./scanEffect.js" /** * Statefully maps over the elements of this stream to produce all intermediate results * of type `S` given an initial S. */ export function scan_( self: C.Stream, s: S, f: (s: S, a: A) => S ): C.Stream { return ScanEffect.scanEffect_(self, s, (s, a) => T.succeed(f(s, a))) } /** * Statefully maps over the elements of this stream to produce all intermediate results * of type `S` given an initial S. * * @ets_data_first scan_ */ export function scan(s: S, f: (s: S, a: A) => S) { return (self: C.Stream) => scan_(self, s, f) }