Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

psSet

psSet

§psSet(K 
type
:ordered psSet.K, psm ref psMap psSet.K unit, dummy unit)
 => 
psSet psSet.K
:
Set psSet.K

psSet -- a partially sorted set based on psMap

psSet is a persistent set of ordered values. This set is generally
well-behaved with respect to cumulative and average performance.

WARNING: Due to the high worst-case time for addition, this structure should
not be used in situations when adding a single element repeatedly to the same
instance of psSet is performance critical. If the resulting set's size n is a
power of 2, this will trigger the worst-case addition time resutling in
O(m*n log² n) for adding an element m times.
add new element k to this set.

redefines:

add all elements of the given Sequence to this set
create a sorted array from the elements of this set

redefines:

list representation of values in this set
does this set contain the given value?

redefines:

an empty psSet
§has(k K)
 => 
bool
:
Any 
check if an element equal to given element k is part of this set
intersection of two psSets
union of two psSets
get the highest element in this set
get the lowest element in this set
print contents of this set
number of elements in this set
number of entries in this set. May be undefined, i.e., a range of
floating point numbers or an infinite set.

redefines:

monoid of psSet with infix ∪ operation.