1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 14:18:13 +01:00
dotSCAD/docs/lib3x-hashset_add.md

23 lines
682 B
Markdown
Raw Normal View History

2021-03-08 18:17:50 +08:00
# hashset_add
2021-03-09 16:58:20 +08:00
This function adds an element to a [util/set/hashset](https://openhome.cc/eGossip/OpenSCAD/lib3x-hashset.html). It returns a new set containing the added element.
2021-03-08 18:17:50 +08:00
**Since:** 3.0
## Parameters
- `set` : The original set.
- `elem` : Adds the specified element to the specified set.
- `eq` : A equality function. If it's ignored, use `==` to compare elements.
- `hash` : A hash function. If it's ignored, convert each element to a string and hash it.
## Examples
2022-06-06 13:11:46 +08:00
use <util/set/hashset.scad>
use <util/set/hashset_add.scad>
use <util/set/hashset_has.scad>
2021-03-08 18:17:50 +08:00
s1 = hashset([1, 2, 3, 4, 5]);
s2 = hashset_add(s1, 9);
assert(hashset_has(s2, 9));