import { array } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { flatmap } = array;
Given a function A -> ReadonlyArray and a ReadonlyArray apply the function to every value in the array and combine all results, returning a ReadonlyArray.
Examples
Example 1
Example 1
import * as A from "./array.ts";
import { pipe } from "./fn.ts";
const result = pipe(
A.range(3, 1, 3), // [1, 4, 7]
A.flatmap(n => [n, n + 1, n + 2]), // ie. 1 -> [1, 2, 3]
); // [1, 2, 3, 4, 5, 6, 7, 8, 9]