Skip to main content
Module

x/fun/mod.ts>pair.reduce

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Go to Latest
function pair.reduce
import { pair } from "https://deno.land/x/fun@v.2.0.0-alpha.11/mod.ts";
const { reduce } = pair;

Reduces a pair with an initial value, also passing the second value into the reducer as well.

Examples

Example 1

import { pair, reduce } from "./pair.ts";
import { pipe } from "./fn.ts";

const result = pipe(
  pair(10, 20),
  reduce(Math.max, Number.NEGATIVE_INFINITY),
); // 20

Parameters

foao: (
acc: O,
first: A,
second: B,
) => O
initial: O

Returns

(ua: Pair<A, B>) => O