HashSet[A: Any #share, H: HashFunction[A] val]
A set, built on top of persistent Map. This is implemented as map of an alias of a type to itself.
class val HashSet[A: Any #share, H: HashFunction[A] val] is Comparable[HashSet[A, H] box] ref
Implements
- Comparable[HashSet[A, H] box] ref
Constructors
create
new val create() : HashSet[A, H] val^
Returns
- HashSet[A, H] val^
Public Functions
size
Return the number of elements in the set.
fun box size() : USize val
Returns
- USize val
apply
Return the value if it is in the set, otherwise raise an error.
fun box apply( value: val->A) : val->A ?
Parameters
- value: val->A
Returns
- val->A ?
contains
Check whether the set contains the value.
fun box contains( value: val->A) : Bool val
Parameters
- value: val->A
Returns
- Bool val
add
Return a set with the value added.
fun val add( value: val->A) : HashSet[A, H] val
Parameters
- value: val->A
Returns
- HashSet[A, H] val
sub
Return a set with the value removed.
fun val sub( value: val->A) : HashSet[A, H] val
Parameters
- value: val->A
Returns
- HashSet[A, H] val
op_or
Return a set with the elements of both this and that.
fun val op_or( that: (HashSet[A, H] val | Iterator[A] ref)) : HashSet[A, H] val
Parameters
Returns
- HashSet[A, H] val
op_and
Return a set with the elements that are in both this and that.
fun val op_and( that: (HashSet[A, H] val | Iterator[A] ref)) : HashSet[A, H] val
Parameters
Returns
- HashSet[A, H] val
op_xor
Return a set with elements that are in either this or that, but not both.
fun val op_xor( that: (HashSet[A, H] val | Iterator[A] ref)) : HashSet[A, H] val
Parameters
Returns
- HashSet[A, H] val
without
Return a set with the elements of this that are not in that.
fun val without( that: (HashSet[A, H] val | Iterator[A] ref)) : HashSet[A, H] val
Parameters
Returns
- HashSet[A, H] val
eq
Return true if this and that contain the same elements.
fun box eq( that: HashSet[A, H] box) : Bool val
Parameters
- that: HashSet[A, H] box
Returns
- Bool val
lt
Return true if every element in this is also in that, and this has fewer elements than that.
fun box lt( that: HashSet[A, H] box) : Bool val
Parameters
- that: HashSet[A, H] box
Returns
- Bool val
le
Return true if every element in this is also in that.
fun box le( that: HashSet[A, H] box) : Bool val
Parameters
- that: HashSet[A, H] box
Returns
- Bool val
gt
Return true if every element in that is also in this, and this has more elements than that.
fun box gt( that: HashSet[A, H] box) : Bool val
Parameters
- that: HashSet[A, H] box
Returns
- Bool val
ge
Return true if every element in that is also in this.
fun box ge( that: HashSet[A, H] box) : Bool val
Parameters
- that: HashSet[A, H] box
Returns
- Bool val
values
Return an iterator over the values in the set.
fun box values() : Iterator[A] ref^
Returns
- Iterator[A] ref^
compare
fun box compare( that: HashSet[A, H] box) : (Less val | Equal val | Greater val)
Parameters
- that: HashSet[A, H] box
Returns
ne
fun box ne( that: HashSet[A, H] box) : Bool val
Parameters
- that: HashSet[A, H] box
Returns
- Bool val
© 2016-2020, The Pony Developers
© 2014-2015, Causality Ltd.
Licensed under the BSD 2-Clause License.
https://stdlib.ponylang.io/collections-persistent-HashSet