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
new val create() : HashSet[A, H] val^
new val _create( map': HashMap[A, A, H] val) : HashSet[A, H] val^
Return the number of elements in the set.
fun box size() : USize val
Return the value if it is in the set, otherwise raise an error.
fun box apply( value: val->A) : val->A ?
Check whether the set contains the value.
fun box contains( value: val->A) : Bool val
Return a set with the value added.
fun val add( value: val->A) : HashSet[A, H] val
Return a set with the value removed.
fun val sub( value: val->A) : HashSet[A, H] val
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
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
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
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
Return true if this and that contain the same elements.
fun box eq( that: HashSet[A, H] box) : Bool val
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
Return true if every element in this is also in that.
fun box le( that: HashSet[A, H] box) : Bool val
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
Return true if every element in that is also in this.
fun box ge( that: HashSet[A, H] box) : Bool val
Return an iterator over the values in the set.
fun box values() : Iterator[A] ref^
fun box compare( that: HashSet[A, H] box) : (Less val | Equal val | Greater val)
fun box ne( that: HashSet[A, H] box) : Bool val
© 2016-2018, The Pony Developers
© 2014-2015, Causality Ltd.
Licensed under the BSD 2-Clause License.
https://stdlib.ponylang.io/collections-persistent-HashSet