logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Set - Sets over ordered types.

Documentation

       Module Set
        : sigend

       Sets over ordered types.

       This module implements the set data structure, given a total ordering function over the set elements. All
       operations  over  sets are purely applicative (no side-effects).  The implementation uses balanced binary
       trees, and is therefore reasonably efficient: insertion and membership take time logarithmic in the  size
       of the set, for instance.

       The Set.Make functor constructs implementations for any type, given a compare function.  For instance:
            moduleIntPairs=structtypet=int*intletcompare(x0,y0)(x1,y1)=matchStdlib.comparex0x1with0->Stdlib.comparey0y1|c->cendmodulePairsSet=Set.Make(IntPairs)letm=PairsSet.(empty|>add(2,3)|>add(5,7)|>add(11,13))

       This creates a new module PairsSet , with a new type PairsSet.t of sets of int*int .

       moduletypeOrderedType=sigend

       Input signature of the functor Set.Make .

       moduletypeS=sigend

       Output signature of the functor Set.Make .

       moduleMake:(Ord:OrderedType)->sigend

       Functor building an implementation of the set structure given a totally ordered type.

OCamldoc                                           2025-06-12                                            Set(3o)

Module

       Module   Set

Name

       Set - Sets over ordered types.

See Also