HashSet[A: Any #share, H: HashFunction[A] val]

[Source]

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

Constructors

create

[Source]

new val create()
: HashSet[A, H] val^

Returns

Public Functions

size

[Source]

Return the number of elements in the set.

fun box size()
: USize val

Returns

apply

[Source]

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

[Source]

Check whether the set contains the value.

fun box contains(
  value: val->A)
: Bool val

Parameters

  • value: val->A

Returns

add

[Source]

Return a set with the value added.

fun val add(
  value: val->A)
: HashSet[A, H] val

Parameters

  • value: val->A

Returns

sub

[Source]

Return a set with the value removed.

fun val sub(
  value: val->A)
: HashSet[A, H] val

Parameters

  • value: val->A

Returns

op_or

[Source]

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

op_and

[Source]

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

op_xor

[Source]

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

without

[Source]

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

eq

[Source]

Return true if this and that contain the same elements.

fun box eq(
  that: HashSet[A, H] box)
: Bool val

Parameters

Returns

lt

[Source]

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

Returns

le

[Source]

Return true if every element in this is also in that.

fun box le(
  that: HashSet[A, H] box)
: Bool val

Parameters

Returns

gt

[Source]

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

Returns

ge

[Source]

Return true if every element in that is also in this.

fun box ge(
  that: HashSet[A, H] box)
: Bool val

Parameters

Returns

values

[Source]

Return an iterator over the values in the set.

fun box values()
: Iterator[A] ref^

Returns

compare

[Source]

fun box compare(
  that: HashSet[A, H] box)
: (Less val | Equal val | Greater val)

Parameters

Returns

ne

[Source]

fun box ne(
  that: HashSet[A, H] box)
: Bool val

Parameters

Returns

© 2016-2020, The Pony Developers
© 2014-2015, Causality Ltd.
Licensed under the BSD 2-Clause License.
https://stdlib.ponylang.io/collections-persistent-HashSet