import { set } from "https://deno.land/x/fun@v2.0.0-alpha.6/mod.ts";
const { partitionMap } = set;
Given a function A -> Either<J, I> and a ReadonlySet return a Pair(ReadonlySet, ReadonlySet) by applying every value A in the set to the partitioning function.
Examples
Example 1
Example 1
import * as S from "./set.ts";
import * as E from "./either.ts";
import { pipe } from "./fn.ts";
const set = S.set("one", "two", "three", "four");
const result = pipe(
set,
S.partitionMap(s => s.includes('o') ? E.right(s) : E.left(s.length)),
); // [Set("one", "two", "four"), Set(5)]