Function reference · Assumptions and sets
intersects
Tests whether two sets have a value in common.
Notation
intersects(set1, set2)
Write it in an expression: nerdamer('intersects({1,2},{2,3})'), or in the Playground.
nerdamer.intersects
nerdamer.intersects(...args: [a, b]): ParserEntity
A method on the default import. Arguments can be strings, as in Notation.
import { intersects }
import { intersects } from 'nerdamer/structures';
intersects(a: ParserEntity, b: ParserEntity): ParserEntity
Import only this function, from nerdamer/structures.
Parameters
set1, set2- Two sets, written
{...}.
Returns
1 when the sets share a value, 0 when they don't.
Examples
If the sets have no value yet, the call is kept as it is.
intersects(A,B)
// → intersects(A, B)Open in PlaygroundGood to know
- Both arguments must be sets. The order doesn't matter.
- It gives the same answer as checking that
intersection(A,B)isn't empty.
JavaScript examples
nerdamer.intersects('{1,2}', '{2,3}').text()
// → 1