`Dd@ 55.5.0+dev0-2025-04-28/#Set+OrderedTypeB!tA;@@@A@@@@@4../../stdlib/set.mlitt@@@@#Set@@A@'compare@#Set+OrderedType!t@@@@#Set+OrderedType!t@@@#int@@@@@@@@)w*w @@(A@@@@-r.  @,B@@!SE#eltC;@@>A@@@@@=G 9 =>G 9 E@@@@59?5Y@@=R@@&choose%@#Set!S!t@@@#Set!S#elt@@@@@@]^@@\S@@*choose_opt&@#Set!S!t@@@#Set!S#elt@@@@@@@@@@@T@@$find'@#Set!S#elt@@@@#Set!S!t@@@#Set!S#elt@@@@@@@@@@U@@(find_opt(@#Set!S#elt@@@@#Set!S!t@@@#Set!S#elt@@@@@@@@@@@@@V@@*find_first)@@#Set!S#elt@@@@@@@@@#Set!S!t@@@#Set!S#elt@@@@@@@@fjf@@ W@@.find_first_opt*@@#Set!S#elt@@@@@@@@@#Set!S!t@@@L#Set!S#elt@@@@@@@@@@@EmqFm@@DX@@)find_last+@@#Set!S#elt@@@@@@@@@#Set!S!t@@@#Set!S#elt@@@@@@@@wx@@vY@@-find_last_opt,@@#Set!S#elt@@@ I@@@ @@ @#Set!S!t@@@ #Set!S#elt@@@ @@@@@@@@@@Z@@$iter-@@#Set!S#elt@@@$unit@@@@@@#Set!S!t@@@@@@@@@@@@@[@@$fold.@@#Set!S#elt@@@@#acc@"E@@@@@@#Set!S!t@@@@@@@@@@ @  @@\@@#map/@@#Set!S#elt@@@##Set!S#elt@@@$@@%@#Set!S!t@@@&#Set!S!t@@@'@@(@@)@@A@@?]@@&filter0@@#Set!S#elt@@@*@@@+@@,@#Set!S!t@@@-#Set!S!t@@@.@@/@@0@r  s  @@q^@@*filter_map1@@#Set!S#elt@@@1#Set!S#elt@@@2@@@4@@5@#Set!S!t@@@6#Set!S!t@@@7@@8@@9@"!"%"!"R@@_@@)partition2@@#Set!S#elt@@@:@@@;@@<@#Set!S!t@@@=@#Set!S!t@@@>@#Set!S!t@@@?@@@@@A@@B@$V$Z$V$@@`@@%split3@#Set!S#elt@@@C@#Set !S!t@@@D@#Set !S!t@@@E@ @@@F@#Set !S!t@@@G@@H@@I@@J@2%u%y3%u%@@1a@@(is_empty4@#Set !S!t@@@K@@@L@@M@L'?'CM'?'Z@@Kb@@#mem5@#Set!S#elt@@@N@#Set!S!t@@@O(@@@P@@Q@@R@r''s''@@qc@@%equal6@#Set!S!t@@@S@#Set!S!t@@@TN@@@U@@V@@W@ '' '(@@d@@'compare7@#Set!S!t@@@X@#Set!S!t@@@Y@@@Z@@[@@\@(z(~(z(@@e@@&subset8@#Set!S!t@@@]@#Set!S!t@@@^@@@_@@`@@a@)) ))%@@f@@'for_all9@@#Set!S#elt@@@b@@@c@@d@#Set!S!t@@@e@@@f@@g@@h@))))@@g@@&exists:@@#Set!S#elt@@@i @@@j@@k@#Set!!S!t@@@l"@@@m@@n@@o@>* *?* *6@@=h@@'to_list;@#Set#!S!t@@@p%#Set$!S#elt@@@q@@@s@@t@c **d **@@bi@@'of_list<@'#Set&!S#elt@@@u@@@w#Set(!S!t@@@x@@y@$+$+($+$+B@@j@@+to_seq_from|@#Set)!S#elt@@@z@#Set*!S!t@@@{&Stdlib,#Seq!t#Set+!S#elt@@@ @@@ @@ @@ @*,,#*,,J@@k@@&to_seq}@#Set-!S!t@@@ &Stdlib/#Seq!t#Set.!S#elt@@@ @@@ @@ @/,,/,,@@l@@*to_rev_seq~@#Set0!S!t@@@ &Stdlib2#Seq!t#Set1!S#elt@@@ @@@ @@ @3-E-I3-E-h@@m@@'add_seq@&Stdlib4#Seq!t#Set3!S#elt@@@ @@@ @#Set5!S!t@@@ #Set6!S!t@@@ @@ @@ @H7--I7--@@Gn@@&of_seq@&Stdlib8#Seq!t#Set7!S#elt@@@ @@@ #Set9!S!t@@@ @@ @r;.*..s;.*.I@@qo@@@@vB  w>..@up@@ӱ$MakeF@#OrdGOH;@@@A!t@@@ @@@@A..A..@@@@r@A@VH;@@@A@@@@@V@@@SA@R @@@ @K@H@G@$@@@ @@@@ @@@ @@ ~@@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@ @@@@ 1@@@ @@ @@ @'@$@#@@@@@ @@@@ @@ @@@@ I@@@ @@ @@ @@@@@@@ )@@@ @@@ @@ @@@@7@@@ @@@ @@@ @@ @@@@@@@ @@@@ &Stdlib#Seq!t@@@ @@@ @@ @@ @@@@@@@ #Seq!t@@@ @@@ @@ @@@@@@@ +#Seq!t@@@ @@@ @@ @@@@<#Seq!t@@@ @@@ @)@@@ ,@@@ @@ @@ @@@@U#Seq!t2@@@ @@@ @@@@ @@ @q@n@@@ A..P@ s@@@@38Sets over ordered types.@ f 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: T module IntPairs = struct type t = int * int let compare (x0,y0) (x1,y1) = match Stdlib.compare x0 x1 with 0 -> Stdlib.compare y0 y1 | c -> c end module PairsSet = Set.Make(IntPairs) let m = PairsSet.(empty |> add (2,3) |> add (5,7) |> add (11,13)) @> This creates a new module (PairsSet2, with a new type *PairsSet.t/ of sets of )int * int!.@@@@@@@@@@@@A4../../stdlib/set.mli/Set.OrderedType3?Input signature of the functor 2@@!.@@@@@@@@@@@@ 4A#1Set.OrderedType.t3=The type of the set elements.@@@@@@@@@@@@@@A@@ ; 9@@7Set.OrderedType.compare3 [A total ordering function over the set elements. This is a two-argument function !f5 such that 'f e1 e29 is zero if the elements "e1% and "e26 are equal, 'f e1 e29 is strictly negative if "e11 is smaller than "e20, and 'f e1 e29 is strictly positive if "e11 is greater than "e2 j. Example: a suitable ordering function is the generic structural comparison function .Stdlib.compare@@!.@@@@@@@@@@@@ }@  @ v@@@@ h@@ f e@%Set.S3 Output signature of the functor @@!.@@@@@@@@@@@@ nAA$sets$Sets@@#)Set.S.elt3=The type of the set elements.@@@@@@@@@@@@@@A@@  ~@@#'Set.S.t31The type of sets.@@@@@@@@@@@@@@A@@  @@+Set.S.empty3.The empty set.@@@@@@@@@@@@ @@@@ })Set.S.add3'add x s * returns a set containing all elements of !s/, plus !x%. If !x0 was already in !s", !s W is returned unchanged (the result of the function is then physically equal to !s").@@@@@$4.03 "Physical equality was not ensured.@@@@@@@@ @ @ @@@@ /Set.S.singleton3+singleton x - returns the one-element set containing only !x!.@@@@@@@@@@@@ @ @@@@ ,Set.S.remove3*remove x s * returns a set containing all elements of !s1, except !x%. If !x, was not in !s", !s W is returned unchanged (the result of the function is then physically equal to !s").@@@@@$4.03 "Physical equality was not ensured.@@@@@@@@ @ @ @@@@ +Set.S.union3*Set union.@@@@@@@@@@@@ @ @ @@@@ +Set.S.inter31Set intersection.@@@@@@@@@@@@ @ @ ~@@@@ l.Set.S.disjoint3>Test if two sets are disjoint.@@@@$4.08@@@@@@@ o@ p@ g@@@@ Y*Set.S.diff30Set difference: *diff s1 s2: contains the elements of "s19 that are not in "s2!.@@@@@@@@@@@@ l@8 m@; d@@@@ R.Set.S.cardinal3 'Return the number of elements of a set.@@@@@@@@@@@@ S@J T@@@@ GA(elements(Elements@@.Set.S.elements3 Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering +Ord.compare(, where #Ord " is the argument given to @@!.@@@@@@@@@@@@ c@t d@@@@ K-Set.S.min_elt3 JReturn the smallest element of the given set (with respect to the +Ord.compare= ordering), or raise )Not_found5 if the set is empty.@@@@@@@@@@@@ X@ Y@@@@ G1Set.S.min_elt_opt3 JReturn the smallest element of the given set (with respect to the +Ord.compare/ ordering), or $None= if the set is empty.@@@@$4.05@@@@@@@ V@ W@@@@ >-Set.S.max_elt3(Same as AD@ ;, but returns the largest element of the given set.@@@@@@@@@@@@ E@ F@@@@ 41Set.S.max_elt_opt3(Same as ;D@ ;, but returns the largest element of the given set.@@@@$4.05@@@@@@@ =@ >@@@@ ',Set.S.choose3 .Return one element of the given set, or raise )Not_found  if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.@@@@@@@@@@@@ .@ /@@@@ 0Set.S.choose_opt3 (Return one element of the given set, or $None  if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.@@@@$4.05@@@@@@@ &@ '@@@@ A)searching)Searching@@*Set.S.find3(find x s8 returns the element of !s* equal to !x7 (according to +Ord.compare,), or raise )Not_found # if no such element exists.@@@@$4.01@@@@@@@ 7@9 8@< /@@@@ .Set.S.find_opt3,find_opt x s8 returns the element of !s* equal to !x7 (according to +Ord.compare&), or $None # if no such element exists.@@@@$4.05@@@@@@@ ;@h <@k 3@@@@ 0Set.S.find_first3.find_first f s(, where !f L is a monotonically increasing function, returns the lowest element !e$ of !s+ such that #f e4, or raises )Not_found; if no such element exists.@6 For example, ,find_first (fun e -> Ord.compare e x >= 0) s ' will return the first element !e$ of !s' where 4Ord.compare e x >= 07 (intuitively: &e >= x,), or raise )Not_found$ if !x ( is greater than any element of !s!.@@@@$4.05@@@@@@@ t@ u@ e@@@@ S4Set.S.find_first_opt32find_first_opt f s(, where !f a is a monotonically increasing function, returns an option containing the lowest element !e$ of !s3 such that #f e%, or $None; if no such element exists.@@@@$4.05@@@@@@@ w@ x@  h@@@@ Q/Set.S.find_last3-find_last f s(, where !f M is a monotonically decreasing function, returns the highest element !e$ of !s+ such that #f e4, or raises )Not_found; if no such element exists.@@@@$4.05@@@@@@@ u@; v@> f@@@@ T3Set.S.find_last_opt31find_last_opt f s(, where !f b is a monotonically decreasing function, returns an option containing the highest element !e$ of !s3 such that #f e%, or $None; if no such element exists.@@@@$4.05@@@@@@@ x@p y@s i@@@@ RA*traversing*Traversing@@*Set.S.iter3(iter f s) applies !f< in turn to all elements of !s:. The elements of !s2 are presented to !f X in increasing order with respect to the ordering over the type of the elements.@@@@@@@@@@@@ w@ x@ g@@@@ Z*Set.S.fold3-fold f s init* computes (f xN ... (f x2 (f x1 init))...)0, where )x1 ... xN5 are the elements of !s6, in increasing order.@@@@@@@@@@@@ p@ q@ ^@ i@@@@ WA,transforming,Transforming@@)Set.S.map3'map f s? is the set whose elements are $f a0!,$f a1$... ,f aN(, where "a0!,"a1#..."aN5 are the elements of !s!.@ $ The elements are passed to !f X in increasing order with respect to the ordering over the type of the elements.@: If no element of !s/ is changed by !f", !s 3 is returned unchanged. (If each output of !f S is physically equal to its input, the returned set is physically equal to !s".)@@@@$4.04@@@@@@@ @F @I @@@@ ,Set.S.filter3*filter f s $ returns the set of all elements in !s that satisfy predicate !f%. If !f< satisfies every element in !s*, !s W is returned unchanged (the result of the function is then physically equal to !s").@@@@@$4.03 "Physical equality was not ensured.@@@@@@@@ @ @ @@@@ 0Set.S.filter_map3.filter_map f s8 returns the set of all !v3 such that ,f x = Some v2 for some element !x$ of !s!.@> For example, Bfilter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s 6 is the set of halves of the even elements of !s!.@: If no element of !s: is changed or dropped by !f- (if ,f x = Some x2 for each element !x0), then !s W is returned unchanged: the result of the function is then physically equal to !s!.@@@@$4.11@@@@@@@ @ @ @@@@ Π/Set.S.partition3-partition f s8 returns a pair of sets ((s1, s2)0, where "s1 # is the set of all the elements of !s $ that satisfy the predicate !f&, and "s2 + is the set of all the elements of !s5 that do not satisfy !f!.@@@@@@@@@@@@ @+ @. @@@@ ˠ+Set.S.split3)split x s2 returns a triple /(l, present, r)0, where !l; is the set of elements of !s % that are strictly less than !x*; !r; is the set of elements of !s ( that are strictly greater than !x*; 'present$ is %false$ if !s> contains no element equal to !x-, or $true$ if !s> contains an element equal to !x!.@@@@@@@@@@@@ #@ $@ @@@@ 򠙠A*predicates:Predicates and comparisons@@.Set.S.is_empty3 #Test whether a set is empty or not.@@@@@@@@@@@@ @ @@@@ )Set.S.mem3'mem x s/ tests whether !x4 belongs to the set !s!.@@@@@@@@@@@@ @ @ @@@@ 렕+Set.S.equal3+equal s1 s28 tests whether the sets "s1% and "s2 4 are equal, that is, contain equal elements.@@@@@@@@@@@@ @ @ @@@@ 栕-Set.S.compare3 aTotal ordering between sets. Can be used as the ordering function for doing sets of sets.@@@@@@@@@@@@ @ @ @@@@ Ҡ,Set.S.subset3,subset s1 s27 tests whether the set "s1 is a subset of the set "s2!.@@@@@@@@@@@@ @! @$ @@@@ ͠-Set.S.for_all3+for_all f s A checks if all elements of the set satisfy the predicate !f!.@@@@@@@@@@@@ @< @? @@@@ ,Set.S.exists3*exists f s K checks if at least one element of the set satisfies the predicate !f!.@@@@@@@@@@@@ @W @Z @@@@ A*converting*Converting@@-Set.S.to_list3)to_list s$ is D@" s!.@@@@#5.1@@@@@@@ @ @@@@ -Set.S.of_list3)of_list l \ creates a set from a list of elements. This is usually more efficient than folding #add O over the list, except perhaps for lists with many duplicated elements.@@@@$4.02@@@@@@@ @ @@@@ 1Set.S.to_seq_from3/to_seq_from x s ) iterates on a subset of the elements of !s " in ascending order, from !x* or above.@@@@$4.07@@@@@@@ @ @ @@@@ ,Set.S.to_seq3 ,Iterate on the whole set, in ascending order@@@@$4.07@@@@@@@ @ @@@@ s0Set.S.to_rev_seq3 -Iterate on the whole set, in descending order@@@@$4.12@@@@@@@ v@ w@@@@ Z-Set.S.add_seq3 ,Add the given elements to the set, in order.@@@@$4.07@@@@@@@ ]@ ^@ J@@@@ 8,Set.S.of_seq3 #Build a set from the given bindings@@@@$4.07@@@@@@@ ;@ <@@@@ @@  @/ 3 XFunctor building an implementation of the set structure given a totally ordered type.@@@@@@@@@@@@A #Set:+OrderedType+OrderedType@6 with type elt = Ord.t@ @@@@@@@@@A@@@@@