# FreeBSD Manual Pages

Set.Make(3) OCaml library Set.Make(3)NAMESet.Make - Functor building an implementation of the set structure given a totally ordered type.ModuleModule Set.MakeDocumentationModuleMake:functor(Ord:OrderedType)->sigendFunctor building an implementation of the set structure given a totally ordered type.Parameters:"Ord"Set.OrderedTypetypeeltThe type of the set elements.typetThe type of sets.valempty:tThe empty set.valis_empty:t->boolTest whether a set is empty or not.valmem:elt->t->boolmemxstests whetherxbelongs to the sets.valadd:elt->t->taddxsreturns a set containing all elements ofs, plusx. Ifxwas already ins,sis returned unchanged.valsingleton:elt->tsingletonxreturns the one-element set containing onlyx.valremove:elt->t->tremovexsreturns a set containing all elements ofs, exceptx. Ifxwas not ins,sis returned unchanged.valunion:t->t->tSet union.valinter:t->t->tSet intersection.valdiff:t->t->tSet difference.valcompare:t->t->intTotal ordering between sets. Can be used as the ordering function for doing sets of sets.valequal:t->t->boolequals1s2tests whether the setss1ands2are equal, that is, con- tain equal elements.valsubset:t->t->boolsubsets1s2tests whether the sets1is a subset of the sets2.valiter:(elt->unit)->t->unititerfsappliesfin turn to all elements ofs. The elements ofsare presented tofin increasing order with respect to the ordering over the type of the elements.valfold:(elt->'a->'a)->t->'a->'afoldfsacomputes(fxN...(fx2(fx1a))...), wherex1...xNare the elements ofs, in increasing order.valfor_all:(elt->bool)->t->boolfor_allpschecks if all elements of the set satisfy the predicatep.valexists:(elt->bool)->t->boolexistspschecks if at least one element of the set satisfies the predicatep.valfilter:(elt->bool)->t->tfilterpsreturns the set of all elements insthat satisfy predicatep.valpartition:(elt->bool)->t->t*tpartitionpsreturns a pair of sets(s1,s2), wheres1is the set of all the elements ofsthat satisfy the predicatep, ands2is the set of all the elements ofsthat do not satisfyp.valcardinal:t->intReturn the number of elements of a set.valelements:t->eltlistReturn the list of all elements of the given set. The returned list is sorted in increasing order with respect to the orderingOrd.compare, whereOrdis the argument given toSet.Make.valmin_elt:t->eltReturn the smallest element of the given set (with respect to theOrd.compareordering), or raiseNot_foundif the set is empty.valmax_elt:t->eltSame asSet.S.min_elt, but returns the largest element of the given set.valchoose:t->eltReturn one element of the given set, or raiseNot_foundif the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.valsplit:elt->t->t*bool*tsplitxsreturns a triple(l,present,r), wherelis the set of ele- ments ofsthat are strictly less thanx;ris the set of elements ofsthat are strictly greater thanx;presentisfalseifscontains no element equal tox, ortrueifscontains an element equal tox.valfind:elt->t->eltfindxsreturns the element ofsequal tox(according toOrd.compare), or raiseNot_foundif no such element exists.Since4.01.0valof_list:eltlist->tof_listlcreates a set from a list of elements. This is usually more efficient than foldingaddover the list, except perhaps for lists with many duplicated elements.Since4.02.0 OCamldoc 2017-04-30 Set.Make(3)

NAME | Module | Documentation

Want to link to this manual page? Use this URL:

<https://www.freebsd.org/cgi/man.cgi?query=Set.Make&sektion=3o&manpath=FreeBSD+12.0-RELEASE+and+Ports>