Package: effect
Module: HashSet
Reduces the specified state over the values of the HashSet.
The time complexity is of O(n).
Example
// Syntax
import { HashSet, pipe } from "effect"
const sum = (a: number, b: number): number => a + b
// with `data-last`, a.k.a. `pipeable` API
pipe(HashSet.make(0, 1, 2), HashSet.reduce(0, sum))
// or with the pipe method
HashSet.make(0, 1, 2).pipe(HashSet.reduce(0, sum))
// or with `data-first` API
HashSet.reduce(HashSet.make(0, 1, 2), 0, sum)
Signature
declare const reduce: { <A, Z>(zero: Z, f: (accumulator: Z, value: A) => Z): (self: HashSet<A>) => Z; <A, Z>(self: HashSet<A>, zero: Z, f: (accumulator: Z, value: A) => Z): Z; }
Since v2.0.0