Abstract

Abstract interface for working with sets.

For implementations of this interface, see:

Synopsis

module type set = {
type key
type ctx
type~ set [n]
val member [n]: ctx -> key -> set [n] -> bool
val not_member [n]: ctx -> key -> set [n] -> bool
val from_array [u]: ctx -> [u]key -> ?[n].set [n]
val from_array_nodup [u]: ctx -> [u]key -> ?[n].set [n]
val to_array [n]: set [n] -> [n]key
val size [n]: set [n] -> i64
val context [n]: set [n] -> ctx
val insert [n] [u]: ctx -> set [n] -> [u]key -> ?[n'].set [n']
}

Description

module type set

A general module type for a key-value map. Specific implementation of this module may provide additional functionality, and may in particular deviate significantly in the efficiency of individual operations.

For the meaning of the context type, see map.

type key

The key type.

type ctx

The context type.

type~ set [n]

The type of sets of size n.

val member [n]: ctx -> key -> set [n] -> bool

Check if a key is member of the set.

val not_member [n]: ctx -> key -> set [n] -> bool

Check if a key is not member of the set

val from_array [u]: ctx -> [u]key -> ?[n].set [n]

Given an array keys construct a set.

val from_array_nodup [u]: ctx -> [u]key -> ?[n].set [n]

Given an array keys construct a set. If the given keys contains duplicates then the function call will never finish. Inturn it does less work.

val to_array [n]: set [n] -> [n]key

Convert set to an array of keys.

val size [n]: set [n] -> i64

The number of elements in the set (n).

val context [n]: set [n] -> ctx

Gets the context of the hashmap.

val insert [n] [u]: ctx -> set [n] -> [u]key -> ?[n'].set [n']

Insert new keys into a set. If a key already exists in the set, the new value will overwrite the old one.