set
Use set when you need a collection of unique values with membership checks.
import "std:set"Example
import "std:set"
set names = set()
names.add("ada")
log names.contains("ada")API reference
Set values
Method
Returns
Notes
value.add(v: any)
*Set
Adds a comparable value.
value.delete(v: any)
error
Deletes through the same guard.
value.contains(v: any)
boolean
Checks membership through the same guard.
value.size()
number
Returns the number of stored values.
value.clear()
void
Clears all stored values.
value.toArr()
array
Converts the value to an array.
Notes
Prefer
import "std:set"; the olderimport "osl/set"spelling remains supported.
Composite and cyclic values are compared safely. Sets synchronize concurrent reads and writes.
Last updated