Function reference · Assumptions and sets
difference
Returns the values of the first set that aren't in the second.
Notation
difference(set1, set2)
Write it in an expression: nerdamer('difference({1,2,3},{2})'), or in the Playground.
nerdamer.difference
nerdamer.difference(...args: [a, b]): ParserEntity
A method on the default import. Arguments can be strings, as in Notation.
import { difference }
import { difference } from 'nerdamer/structures';
difference(set1: ParserEntity, set2: ParserEntity): ParserEntity
Import only this function, from nerdamer/structures.
Parameters
set1- The set to take values from.
set2- The values to leave out.
Returns
A set.
Examples
Good to know
- Both arguments must be sets. The order matters:
difference(A,B)keeps what is inAonly.
JavaScript examples
nerdamer.difference('{1,2,3}', '{2}').text()
// → {1, 3}