// ets_tracing: off import * as HS from "../../../Collections/Immutable/HashSet/index.js" import type * as C from "./core.js" import * as FoldWeighted from "./foldWeighted.js" /** * A sink that collects first `n` distinct inputs into a set. */ export function collectAllToSetN( n: number ): C.Sink> { return FoldWeighted.foldWeighted>( HS.make(), (acc, in_) => (HS.has_(acc, in_) ? 0 : 1), n, (s, a) => HS.add_(s, a) ) }