Function reference · Assumptions and sets

issubset

Tests whether every value of the first set is in the second.

Notation

issubset(set1, set2)

Write it in an expression: nerdamer('issubset({1},{1,2})'), or in the Playground.

nerdamer.issubset

nerdamer.issubset(...args: [a, b]): ParserEntity

A method on the default import. Arguments can be strings, as in Notation.

import { isSubset }

import { isSubset } from 'nerdamer/structures';
isSubset(set1: ParserEntity, set2: ParserEntity): ParserEntity

Import only this function, from nerdamer/structures.

Parameters

set1
The set whose values are checked.
set2
The set to look for them in.

Returns

1 when set1 is a subset of set2, 0 otherwise.

Examples

1 is in the second set.

issubset({1},{1,2})
// → 1
Open in Playground

The order matters: 2 isn't in the second set.

issubset({1,2},{1})
// → 0
Open in Playground

The empty set is a subset of every set.

issubset({},{1})
// → 1
Open in Playground

If the sets have no value yet, the call is kept as it is.

issubset(A,B)
// → issubset(A, B)
Open in Playground

Good to know

  • Both arguments must be sets.
  • issubset(A,B) is the same as the comparison A <= B.

JavaScript examples

nerdamer.issubset('{1}', '{1,2}').text()
// → 1

Deprecated names

Deprecated.

is_subset still works, and gives the same result as issubset, but each call records an api.deprecatedFunction warning. Use issubset instead; the old name will be removed in a later major version.

← Back to Function reference