package tablecloth-base

  1. Overview
  2. Docs

Module Set.PolySource

Construct sets which can hold any data type using the polymorphic compare function.

Sourcetype identity
Sourcetype nonrec 'a t = ('a, identity) t
Sourceval empty : unit -> 'a t

The empty set.

A great starting point.

Sourceval singleton : 'a -> 'a t

Create a set of a single value

Examples

Set.Poly.singleton 5 "Emu" |> Set.to_list = [(5, "Emu")]
Sourceval from_array : 'a array -> 'a t

Create a set from an Array

Examples

Set.Poly.from_array [|(1, "Ant");(2, "Bat");(2, "Bat")|] |> Set.to_list = [(1, "Ant"); (2, "Bat")]
Sourceval from_list : 'a list -> 'a t

Create a set from a List

Examples

Set.Poly.from_list [(1, "Ant");(2, "Bat");(2, "Bat")] |> Set.to_list = [(1, "Ant"); (2, "Bat")]
OCaml

Innovation. Community. Security.