import { array } from "https://deno.land/x/fun@v2.0.0-alpha.6/mod.ts";
const { ap } = array;
Given an array of functions ReadonlyArray<A -> I> and a ReadonlyArray apply every function in the function array to every value in the ReadonlyArray. This implementation loops first over the functions, and then over the values, so the order of results will be [fn1(val1), fn2(val1), fn3(val1), ..., fn1(val2), fn2(val2), ... fn1(valN), ... fnN(valN)].
Examples
Example 1
Example 1
import * as A from "./array.ts";
import { pipe } from "./fn.ts";
const result = pipe(
A.of((n: number) => n + 1),
A.ap(A.array(1, 2, 3)),
); // [2, 3, 4]
Parameters
ua: ReadonlyArray<A>