Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

fold

import { fold } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/set.ts";

Reduce a ReadonlySet to a value O by iterating over the values of the set and collecting them with the reducing function.

@example
import * as S from "./set.ts";
import { pipe } from "./fn.ts";

const set = S.set(1, 2, 3, 4);

const result = pipe(
  set,
  S.fold((previous, current) => previous + current, 0),
); // 10
function fold<A, O>(foao: (o: O, a: A) => O, o: O): (ua: ReadonlySet<A>) => O;
§
fold<A, O>(foao: (o: O, a: A) => O, o: O): (ua: ReadonlySet<A>) => O
[src]

§Type Parameters

§Parameters

§
foao: (o: O, a: A) => O
[src]

§Return Type

§
(ua: ReadonlySet<A>) => O
[src]