A JavaScript library focused on providing functions and utilities for discrete mathematics operations.
To install discrete-math, use npm:
npm install discrete-math
import { difference } from 'discrete-math/set';
This module provides functions for set operations.
Returns the difference between two sets or arrays. The difference is the set of elements that belong to setA but not to setB.
Parameters:
- setA (Set|Array): The first set or array.
- setB (Set|Array): The second set or array, from which elements will be subtracted.
Return: A new set containing elements that are in 'setA' but not in 'setB'.
Example:
const setA = [1, 2, 3];
const setB = [1, 3];
console.log(difference(setA, setB)); // Outputs: Set { 2 }
Contributions are always welcome! Please ensure that you adhere to the established coding standards and provide tests for any new or changed functionality.
If you find any bugs or have a feature request, please open an issue on GitHub.