Skip to main content
Module

x/fun/mod.ts>set.isSubset

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
function set.isSubset
import { set } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { isSubset } = set;

Given an instance of Comparable return a function second => first => boolean that returns true when every member of first is in second.

Examples

Example 1

import * as S from "./set.ts";
import * as N from "./number.ts";
import { pipe } from "./fn.ts";

const subset = S.isSubset(N.ComparableNumber);

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

const result1 = pipe(big, subset(small)); // false
const result2 = pipe(small, subset(big)); // true;

Parameters

S: Comparable<A>

Returns

(second: ReadonlySet<A>) => (first: ReadonlySet<A>) => boolean