next up previous index
Next: Set implementations Up: Unordered collections Previous: Unordered collections   Index

Sets

In set.diesel:

extend module Stdlib;
module Set;
Sets are a specialization of unordered collections that explicitly disallow duplicates.

abstract class set[T <= comparable[T]]
                                        isa unordered_collection_exactly[T];
Sets refine the unordered collection set-like operations to return sets, not just plain unordered collections.

fun copy_mutable(:set[`T]):m_set[T];
abstract class i_set[T <= comparable[T]]
                                isa set[T], i_unordered_collection_exactly[T];
One standard implementation of an immutable set is the concrete object empty_set.

object empty_set[T <= comparable[T]] isa i_set[T];
Mutable sets can be added to.

abstract class m_set[T <= comparable[T]] isa set[T],
                                                    m_unordered_collection[T],
                                                    removable_collection[T];
  fun check_if_missing_and_add(m:m_set[`T], x:T):bool;

next up previous index
Next: Set implementations Up: Unordered collections Previous: Unordered collections   Index

Cecil/Vortex Project