Caml1999I037F 444/Stdlib__Hashtbl!t;!a@E!b@D@B@A@OO@BB@@@+hashtbl.mli~  ~  @@@@@@A@&create&random&optionL$boolE@@@F@@@G@#intA@@@H8!a@J!b@I@@@K@@L@@M@1A ! !2B c @@JA@@%clear@!a@O!b@N@@@P$unitF@@@Q@@R@OiPi@@hB@@%reset@7!a@T!b@S@@@U@@@V@@W@km^^lm^|@@C@@$copy@S!a@Z!b@Y@@@X`  @@@[@@\@rr @@D@@#add@p!a@^!b@_@@@]@ @ [@@@`@@a@@b@@c@u;;u;c@@E@@$find@!a@e!b@f@@@d@ @@g@@h@@@F@@(find_opt@!a@j!b@k@@@i@ Π @@@l@@m@@n@@@G@@(find_all@ɠ!a@p!b@q@@@o@ $listK @@@r@@s@@t@JJJt@@H@@#mem@!a@w!b@u@@@v@ @@@x@@y@@z@ LL!Ln@@9I@@&remove@!a@}!b@{@@@|@ @@@~@@@@@>?@@WJ@@'replace@&!a@!b@@@@@ @ @@@@@@@@@@^_@@wK@@$iter@@!a@@!b@,@@@@@@@@X@@@7@@@@@@@@ @@L@@2filter_map_inplace@@!a@@!b@@@@@@@@@@@@^@@@@@@@@\\@@M@@$fold@@!a@@!b@@#acc@@@@@@@@@@@@  @@@@@@@! ! !!R@@N@@&length@!a@!b@@@@@@@@@@$$$$@@O@@)randomize@@@@@@@@@@%%%%@@P@@-is_randomized@@@@@@@@@@)&)&)&)F@@,Q@@'rebuild&random@@@@@@@!a@!b@@@@  @@@@@@@@<))=* *&@@UR@@*statistics;@@,num_bindings&@@-@@@N,,O,,@@gT@+num_buckets'@@9@@@Z -P-R[ -P-c@@sU@1max_bucket_length(@@E@@@f --g --@@V@0bucket_histogram)@@%arrayJW@@@@@@y --z --@@W@@@A@@@@@},,~..@@@@S@A@%stats@e!a@!b@@@@V@@@@@@....@@X@@&to_seq@!a@à!b@@@@&Stdlib#Seq!t@@@@@@@@@@////@@Y@@+to_seq_keys@!a@ɠ@@@@@'#Seq!t@@@@@@&1U1U&1U1{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@@@@_@U@cR@@@`@@a@@b@ @@@dQ@@@e@@f@@g@P@M@L?@@@@@h@K@l@H@n@@i@@j@@k@ @@@m@  @@o@@p@@q@E@B@A@@@@r@@@s=@@@t@@u@<@9@8A@7@v@@@w (@@@x@@y@4@1@0B@*/@{@@@z ,+@@@@|@@@}@@@~@@@*@'@&C@D @@@@ 4%$@@@@@@@@@#@ @D@X@@@@ H@@@@@@@@E@i@@@@@ [@;@@@@@@@@@@@@@@@@@@ @ F@ @@@@@ z@Z@@@@@@@@@@@@@@@@@@@G@ @r@@@@@@@@@@@@@@@@@@@@ WJJ@ o^@@@$hash@!a@ H@@@@@@ iN,N, jN,N@@@ _@@+seeded_hash@ W@@@@!a@ a@@@@@@@@  O3O3  O3OU@@ `@@*hash_param@ p@@@@ v@@@@!a@ @@@@@@@@@@ OO OO@@ a@@1seeded_hash_param@ @@@@ @@@@ @@@@!a@ @@@@@@@@@@@@ "T T  "T TC@@ b@@@_L/Stdlib__Hashtbl0ѱN][/!+Stdlib__Seq0nwzG&amg.Stdlib__Either0Vy`u~c à&Stdlib0Lku]8_٠8CamlinternalFormatBasics0%FU(Q/Tu@^#@5unsynchronized_access ?Unsynchronized accesses to hash tables are a programming error.@A@Caml1999T037-a'[C/Stdlib__Hashtbl*ocaml.text&_none_@@A g Hash tables and hash functions. Hash tables are hashed association tables, with in-place modification. Because most operations on a hash table modify their input, they're more commonly used in imperative code. The lookup of the value associated with a key (see {!find}, {!find_opt}) is normally very fast, often faster than the equivalent lookup in {!Map}. The functors {!Make} and {!MakeSeeded} can be used when performance or flexibility are key. The user provides custom equality and hash functions for the key type, and obtains a custom hash table type for this particular type of key. {b Warning} a hash table is only as good as the hash function. A bad hash function will turn the table into a degenerate association list, with linear time lookup instead of constant time lookup. The polymorphic {!t} hash table is useful in simpler cases or in interactive environments. It uses the polymorphic {!hash} function defined in the OCaml runtime (at the time of writing, it's SipHash), as well as the polymorphic equality [(=)]. See {{!examples} the examples section}. +hashtbl.mliSj 3 5@@@@@@3@@@@@@#intA;@@@A@@@@@:@A@$charB;@@A@@@@@>@A@&stringQ;@@ A@@@@@B@@@%bytesC;@@ A@@@@@F@@@%floatD;@@A@@@@@J@@@$boolE;@@%falsec@@T@$trued@@Z@@@A@@@@@[@A@$unitF;@@"()e@@e@@@A@@@@@f@A@ #exnG;@@@A@@@@@j@@@#effH;@@O@A@A@@@@@@s@@@,continuationI;@@Q@@P@B@A@nY@@@@@@@@@%arrayJ;@@R@A@A@@@@@@@@@ $listK;@@S@A"[]f@@@"::g@@@T@@@ @@A@Y@@@@@@@@&optionL;@@V@A$Noneh@@@$Somei@@@@@A@Y@@@@@@@@)nativeintM;@@A@@@@@@@@%int32N;@@A@@@@@@@@%int64O;@@A@@@@@@@@&lazy_tP;@@X@AJA@Y@@@@@@@@5extension_constructorR;@@A@@@@@@@@*floatarrayS;@@A@@@@@@@@&iarrayT;@@Y@A[A@Y@@@@@@@@*atomic_locU;@@Z@AdA@@@@@@@@@.Assert_failure`#@@@@@J@@@@@@@@[@@A=ocaml.warn_on_literal_pattern @ @0Division_by_zero]#@@@A  @+End_of_file\#$@@@A@'FailureY#,@'@@A!$$@0Invalid_argumentX#5@0@@A*$-#-@-Match_failureV#>@@=@9@;@@a@@A;5>4>@)Not_foundZ#O@@@AC=F<F@-Out_of_memoryW#W@@@AKENDN@.Stack_overflow^#_@@@ASMVLV@.Sys_blocked_io_#g@@@A[U^T^@)Sys_error[#o@j@@Ad^g]g@:Undefined_recursive_modulea#x@@w@s@u@@h@@Auoxnx@:Continuation_already_takenb#@@@A}wv@&Stdlib@Ax= {b Unsynchronized accesses} l 7 7l 7 Y@@@@@@'warningn [ _n [ f@#-53n [ hn [ k@@n [ gn [ l@@@@@@n [ [n [ m@@%alerto n ro n w@5unsynchronized_accesso n xo n @@@@@ ?Unsynchronized accesses to hash tables are a programming error.p  p  @@p  p  @@@@@@@@@@o n nq  @̰@'warningr  r  @#+53r  r  @@r  r  @@@@@@r  r  @@ Unsynchronized accesses to a hash table may lead to an invalid hash table state. Thus, concurrent accesses to a hash tables must be synchronized (for instance with a {!Mutex.t}). t  x  @@@@@@7 {1 Generic interface}  {  {  @@@@@@ A+!tA~  ~  @А!a@3@;@@@@@B@A@GG@BB@@@1~  @)ocaml.docC 6 The type of hash tables from type ['a] to type ['b]. @  A  @@@@@@@@@Y@@@AD~  E~  @@B@А!b@-P~  Q~  @@ @;5 @B@A@OO@BB@@@*(@@@@A@*(j'&@&&@@@&@&@@b5M@&createnA ! %oA ! +@б&randomг9$bool{A ! [|A ! _@@ @@@3}||}}}}}@|n0@A@@б@г_#intB c pB c s@@ @@@@@г!tB c B c @А!a@B@$B c xB c z@@А!b@B@0B c |B c ~@@@! @@@8B c w @@@. @@<1#@@M%F@@@ @@DA ! .,@@ @A ! !/@ ; [Hashtbl.create n] creates a new, empty hash table, with initial size greater or equal to the suggested size [n]. For best results, [n] should be on the order of the expected number of elements that will be in the table. The table grows as needed, so [n] is just an initial guess. If [n] is very small or negative then it is disregarded and a small default size is used. The optional [~random] parameter (a boolean) controls whether the internal organization of the hash table is randomized at each execution of [Hashtbl.create] or deterministic over all executions. A hash table that is created with [~random] set to [false] uses a fixed hash function ({!hash}) to distribute keys among buckets. As a consequence, collisions between keys happen deterministically. In Web-facing applications or other security-sensitive applications, the deterministic collision patterns can be exploited by a malicious user to create a denial-of-service attack: the attacker sends input crafted to create many collisions in the table, slowing the application down. A hash table that is created with [~random] set to [true] uses the seeded hash function {!seeded_hash} with a seed that is randomly chosen at hash table creation time. In effect, the hash function used is randomly selected among [2^{30}] different hash functions. All these hash functions have different collision patterns, rendering ineffective the denial-of-service attack described above. However, because of randomization, enumerating all elements of the hash table using {!fold} or {!iter} is no longer deterministic: elements are enumerated in different orders at different runs of the program. If no [~random] parameter is given, hash tables are created in non-random mode by default. This default can be changed either programmatically by calling {!randomize} or by setting the [R] flag in the [OCAMLRUNPARAM] environment variable. @before 4.00 the [~random] parameter was not present and all hash tables were created in non-randomized mode. C  g@@@@@@@A@@?@鐠@@@@@@d%clearii@б@гߠ!tii@А!a@B@3@>@Aii@@А!b@B@ii@@@# @@@i"@@гΠ$unit!i"i@@ @@@$@@@@@'@@@,i @ t Empty a hash table. Use [reset] instead of [clear] to shrink the size of the bucket table to its initial size. 9j:k(\@@@@@@@RB@@@ M@@@@@@F%resetPm^bQm^g@б@гC!t[m^s\m^t@А!a@B@3cbbccccc@e>@Aim^kjm^m@@А!b@B@um^ovm^q@@@# @@@}m^j"@@г2$unitm^xm^|@@ @@@$@@@@@'@@@m^^ @_ e Empty a hash table and shrink the size of the bucket table to its initial size. @since 4.00 n}}p@@@@@@@C@@@o@@@@@@F$copyrr@б@г!trr@А!a@B@3@e>@Arr@@А!b@B@rr@@@# @@@r"@@гѠ!tr r @А!a*%rr@@А!b#,rr @@@7*@@@4r@@@' @@8"@@@r@Ԑ ' Return a copy of the given hashtable. s  s 9@@@@@@@+D@@,@&@@@@@@W#add)u;?*u;B@б@г!t4u;N5u;O@А!a@B@3<;;<<<<<@v>@ABu;FCu;H@@А!b@B@Nu;JOu;L@@@# @@@Vu;E"@@б@А!a"]u;S^u;U@@б@А!b%eu;Yfu;[@@г$unitnu;_ou;c@@ @@@4@@@.@@7@@@?@@: @@@,@@='@@@u;;@N  [Hashtbl.add tbl key data] adds a binding of [key] to [data] in table [tbl]. {b Warning}: Previous bindings for [key] are not removed, but simply hidden. That is, after performing {!remove}[ tbl key], the previous binding for [key], if any, is restored. (Same behavior as with association lists.) If you desire the classic behavior of replacing elements, see {!replace}. vdd@@@@@@@E@@!@^@@@@@@\$find@б@г!t  @А!a@B@3@{>@A@@А!b@B@@@@# @@@"@@б@А!a"@@А!b#@@@-@@( @@@@@+@@@ @ w [Hashtbl.find tbl x] returns the current binding of [x] in [tbl], or raises [Not_found] if no such binding exists. ^@@@@@@@ F@@@@@@@@@J(find_opt  @б@г!t@А!a@B@3@i>@A$%@@А!b@B@01@@@# @@@8"@@б@А!a"?@@@г&optionHI@А!b$-OP@@@*@@@4 @@@<@@7@@@)@@:$@@@^@- [Hashtbl.find_opt tbl x] returns the current binding of [x] in [tbl], or [None] if no such binding exists. @since 4.05 kl6H@@@@@@@G@@&@=@@@@@@Y(find_allJNJV@б@гu!tJbJc@А!a@B@3@x>@AJZJ\@@А!b@ B@J^J`@@@# @@@JY"@@б@А!a"JgJi@@г;$listJpJt@А!b$-JmJo@@@*@@@4 @@@<@@7@@@)@@:$@@@JJ@ [Hashtbl.find_all tbl x] returns the list of all data associated with [x] in [tbl]. The current binding is returned first, then the previous bindings, in reverse order of introduction in the table. uu J@@@@@@@H@@&@@@@@@@Y#memLPLS@б@г점!tL_L`@А!a@B@ 3        @x>@ALWLY@@А!b@B@ L[L]@@@# @@@&LV"@@б@А!a"-Ld.Lf@@г$bool6Lj7Ln@@ @@@,@@@4@@/@@@!@@2 @@@DLL@ 6 [Hashtbl.mem tbl x] checks if [x] is bound in [tbl]. QooRo@@@@@@@jI@@@#e@@@@@@Q&removehi@б@г[!tst@А!a@B@3{zz{{{{{@p>@A@@А!b@!B@@@@# @@@"@@б@А!a"@@гR$unit@@ @@@,@@@4@@/@@@!@@2 @@@@ [Hashtbl.remove tbl x] removes the current binding of [x] in [tbl], restoring the previous binding if it exists. It does nothing if [x] is not bound in [tbl]. J}@@@@@@@J@@@Ԑ@@@@@@Q'replace@б@гʠ!t@А!a@,B@"3@p>@A@@А!b@.B@#@@@# @@@&"@@б@А!a"  @@б@А!b%@@гɠ$unit@@ @@@'4@@@.@@(7@@@?@@): @@@,@@*='@@@-@ % [Hashtbl.replace tbl key data] replaces the current binding of [key] in [tbl] by a binding of [key] to [data]. If [key] is unbound in [tbl], a binding of [key] to [data] is added to [tbl]. This is functionally equivalent to {!remove}[ tbl key] followed by {!add}[ tbl key data]. :;@@@@@@@SK@@!@ N@@@@@@\$iterQR@б@б@А!a@;B@/3\[[\\\\\@s6@Abc@@б@А!b@=B@0op@@г%$unitxy@@ @@@1@@@@@2!@@@)@@3$" @@б@гu!t@А!a94@@А!b1;@@@F8@@@6C@@гX$unit @@ @@@7Q@@@@@8T@@@5@@9W @@@@ I [Hashtbl.iter f tbl] applies [f] to all bindings in table [tbl]. [f] receives the key as first argument, and the associated value as second argument. Each binding is presented exactly once to [f]. The order in which the bindings are passed to [f] is unspecified. However, if the table contains several bindings for the same key, they are passed to [f] in reverse order of introduction, that is, the most recent binding is passed first. If the hash table was created in non-randomized mode, the order in which the bindings are enumerated is reproducible between successive runs of the program, and even between minor versions of OCaml. For randomized hash tables, the order of enumeration is entirely random. The behavior is not specified if the hash table is modified by [f] during the iteration.   XZ@@@@@@@L@@@ې@@@@@@w2filter_map_inplace\`\r@б@б@А!a@KB@>3@6@A\u\w@@б@А!b@MB@?\{\}@@гd&option\\@А!b \ \@@@@@@A& @@@@@B)@@@1@@C,*@@б@г !t"\#\@А!aA<)\*\@@А!b9C0\1\@@@N@@@@FK8\@@г$unit@A@@ @@@GY@@@@@H\@@@5@@I_L\t @@@O\\@ ` [Hashtbl.filter_map_inplace f tbl] applies [f] to all bindings in table [tbl] and update each binding depending on the result of [f]. If [f] returns [None], the binding is discarded. If it returns [Some new_val], the binding is update to associate the key to [new_val]. Other comments for {!iter} apply as well. @since 4.03 \] ! @@@@@@@uM@@@.p@@@@@@$fold s! !t! !@б@б@А!a@[B@N3~}}~~~~~@6@A!!!!@@б@А!b@_B@O!!!!!#@@б@А#acc@]B@P!!'!!+@@А#acc "!!/!!3@@@@@Q' @@@ @@R*@@@2@@S-+ @@б@г!t!!A!!B@А!aB=!!9!!;@@А!b:D!!=!!?@@@OA@@@VL!!8@@б@А#acc<S!!F!!J@@А#accBY!!N!!R@@@GG@@W^ @@@@@Xa@@@9@@Yd!! @@@! ! @ c [Hashtbl.fold f tbl init] computes [(f kN dN ... (f k1 d1 init)...)], where [k1 ... kN] are the keys of all bindings in [tbl], and [d1 ... dN] are the associated values. Each binding is presented exactly once to [f]. The order in which the bindings are passed to [f] is unspecified. However, if the table contains several bindings for the same key, they are passed to [f] in reverse order of introduction, that is, the most recent binding is passed first. If the hash table was created in non-randomized mode, the order in which the bindings are enumerated is reproducible between successive runs of the program, and even between minor versions of OCaml. For randomized hash tables, the order of enumeration is entirely random. The behavior is not specified if the hash table is modified by [f] during the iteration. !S!S$$@@@@@@@ N@@@ @@@@@@&length! $$ $$@б@г!t $$ $$@А!a@hB@`3        @>@A &$$ '$$@@А!b@jB@a 2$$ 3$$@@@# @@@d :$$"@@г #int B$$ C$$@@ @@@e$@@@@@f'@@@ M$$ @ [Hashtbl.length tbl] returns the number of bindings in [tbl]. It takes constant time. Multiple bindings are counted once each, so [Hashtbl.length] gives the number of times [Hashtbl.iter] calls its first argument.  Z$$ [%%@@@@@@@ sO@@@, n@@@@@@F)randomize" q%% r%%@б@г )$unit |%% }%%@@ @@@k3 ~ } } ~ ~ ~ ~ ~@_z8@A@@г 8$unit %% %%@@ @@@l@@@@@m@@@ %% @e > After a call to [Hashtbl.randomize()], hash tables are created in randomized mode by default: {!create} returns randomized hash tables, unless the [~random:false] optional parameter is given. The same effect can be achieved by setting the [R] parameter in the [OCAMLRUNPARAM] environment variable. It is recommended that applications or Web frameworks that need to protect themselves against the denial-of-service attack described in {!create} call [Hashtbl.randomize()] at initialization time before any domains are created. Note that once [Hashtbl.randomize()] was called, there is no way to revert to the non-randomized default behavior of {!create}. This is intentional. Non-randomized hash tables can still be created using [Hashtbl.create ~random:false]. @since 4.00  %% ))$@@@@@@@ P@@@u @@@@@@1-is_randomized# )&)* )&)7@б@г r$unit )&): )&)>@@ @@@n3        @J_8@A@@г $bool )&)B )&)F@@ @@@o@@@@@p@@@ )&)& @ y Return [true] if the tables are currently created in randomized mode by default, [false] otherwise. @since 4.03  )G)G ))@@@@@@@ Q@@@ @@@@@@1'rebuild$ )) ))@б&randomг Π$bool )* )*@@ @@@q3        @La:@A@@б@г !t !* * "* *@А!a@~B@r -* * .* *@@А!b@B@s# 9* * :* *@@@! @@@v+ A* * @@г1!t I* *% J* *&@А!a(: P* * Q* *@@А!b#A W* *! X* *#@@@5*@@@yI _* *@@@' @@zM"@@^V@@@{ @@|T j))!@@ @ m))$@<  Return a copy of the given hashtable. Unlike {!copy}, {!rebuild}[ h] re-hashes all the (key, value) entries of the original table [h]. The returned hash table is randomized if [h] was randomized, or the optional [random] parameter is true, or if the default is to create randomized hash tables; see {!create} for more information. {!rebuild} can safely be used to import a hash table built by an old version of the {!Hashtbl} module, then marshaled to persistent storage. After unmarshaling, apply {!rebuild} to produce a hash table for the current version of the {!Hashtbl} module. @since 4.12  z*'*' {,,@@@@@@@ R@@4@L @@@@@@tA+*statistics%B ,, ,,@@;@@,num_bindings&@@ t@@@ ,, ,,@o W Number of bindings present in the table. Same value as returned by {!length}.  ,, - -O@@@@@@@ T@+num_buckets'@@ @@@  -P-R  -P-c@ ! Number of buckets in the table.   -d-h  -d-@@@@@@@ U@1max_bucket_length(@@ @@@  --  --@ ( Maximal number of bindings per bucket.   --  --@@@@@@@ V@0bucket_histogram)@@ u @@@@@@  --  --@ Histogram of bucket sizes. This array [histo] has length [max_bucket_length + 1]. The value of [histo.(i)] is the number of buckets whose size is [i].  -- .j.@@@@@@@ W@@@A@@@@@ ,, ..@Ԑ- @since 4.00  ,, ,,@@@@@@@@@ +S@@#{ ,,@l@@Ш@г#int #,, $,,@@3 " ! ! " " " " "@);@@@A@@@@@'$@@@A@@@@@ =@@@@@@# < -P-]@t@@Ш@г#int E -P-_ F -P-b@@"@@@@%@  Z@@@@@@# Y --@w@@Ш@г#int b -- c --@@?@@@@B@ 5 w@@@@@@# v --@u@@Ш@г%array  --@г#int  --  --@@d@@@e@@@@h@ [ @@@@@@@A@ f @@@@@@@3        @}@A@%stats* .. ..@б@г !t .. ..@А!a@C@3        @71@A .. ..@@А!b@C@ .. ..@@@# @@@ .."@@гP*statistics .. ..@@ @@@$@@@@@'@@@ .. @ [Hashtbl.stats tbl] returns statistics about the table [tbl]: number of buckets, size of the biggest bucket, distribution of buckets by size. @since 4.00  .. /m/~@@@@@@@ X@@@  @@@@@@F  ? {1 Hash tables and Sequences}  // //@@@@@@3        @Xs1@A&to_seqj $// %//@б@г !t /// 0//@А!a@ C@  ;// <//@@А!b@ C@, G// H//@@@! @@@4 O// @@г #Seq!t [// \//@  _// `//@@В@А!a5P k// l//@@@А!b1X s// t//@@@@D@:@@ a@@@, @@@ f //"@@@;@@ j6%@@@ //(@ V ~ Iterate on the whole table. The order in which the bindings appear in the sequence is unspecified. However, if the table contains several bindings for the same key, they appear in reversed order of introduction, that is, the most recent binding appears first. The behavior is not specified if the hash table is modified during the iteration. @since 4.07  // $1A1S@@@@@@@ Y@@8@ f @@@@@@+to_seq_keysk &1U1Y &1U1d@б@г !t &1U1n &1U1o@А!a@ C@ 3        @>@A &1U1h &1U1j@@@@@   &1U1k &1U1l@@@ @@@  &1U1g@@г d#Seq!t &1U1v &1U1y@  &1U1z &1U1{@@А!a.) &1U1s &1U1u@@@4@@@ 0@@@'@@ 3"@@@ &1U1U@ Ɛ 2 Same as [Seq.map fst (to_seq m)] @since 4.07  '1|1| (11@@@@@@@ Z@@$@  @@@@@@R-to_seq_valuesl *11 *11@б@г !t &*11 '*11@@@@ 3 ) ( ( ) ) ) ) )@l9@A /*11 0*11@@А!b@ C@  ;*11 <*11@@@ @@@  C*11@@г #Seq!t O*11 P*11@  S*11 T*11@@А!b%. [*11 \*11@@@+@@@ 5@@@'@@ 8"@@@ g*11@ 6 2 Same as [Seq.map snd (to_seq m)] @since 4.07  t+11 u,22@@@@@@@ [@@$@ F @@@@@@W'add_seqm .22 .22"@б@г ~!t .22- .22.@А!a@ C@ 3        @v>@A .22& .22(@@А!b@ C@  .22) .22+@@@# @@@  .22%"@@б@г K#Seq!t .22< .22?@  .22@ .22A@@В@А!a94 .223 .225@@@А!b3< .228 .22:@@@@H@<@@ E@@@, @@@ J .222"@@г $unit .22E .22I@@ @@@ X@@@@@ [@@@M@@ ^H @@@.22@ ѐ C Add the given bindings to the table, using {!add} @since 4.07 /2J2J022@@@@@@@(\@@@ #@@@@@@}+replace_seqn&222'222@б@г !t12222222@А!a@ C@ 398899999@>@A?222@222@@А!b@ C@ K222L222@@@# @@@ S222"@@б@г #Seq!ta222b222@ e222f222@@В@А!a94q222r222@@@А!b3<y222z222@@@@H@<@@ E@@@, @@@ J222"@@г<$unit222222@@ @@@ X@@@@@ [@@@M@@ ^H @@@222@ l G Add the given bindings to the table, using {!replace} @since 4.07 322433@@@@@@@]@@@ |@@@@@@}&of_seqo633633#@б@г U#Seq!t63306333@ 63346335@@В@А!a@ C@ 3@K@A633'633)@@@А!b@ C@ 633,633.@@@@@@@ @@@8 @@@ 633&.@@г !t 633B 633C@А!a1,633:633<@@А!b)3633>633@@@@>0@@@ ; 6339@@@& @@ ?"@@@&633@ Build a table from the given bindings. The bindings are added in the same order they appear in the sequence, using {!replace_seq}, which means that if two pairs have the same key, only the latest one will appear in the table. @since 4.07 373D3D4;464H@@@@@@@L^@@,@ G@@@@@@^UT: {1 Functorial interface} Q=4J4JR=4J4i@@@@@@3POOPPPPP@p1@Ahg  The functorial interface allows the use of specific comparison and hash functions, either for performance/security concerns, or because keys are not hashable/comparable with the polymorphic builtins. For instance, one might want to specialize a table for integer keys: {[ module IntHash = struct type t = int let equal i j = i=j let hash i = i land max_int end module IntHashtbl = Hashtbl.Make(IntHash) let h = IntHashtbl.create 17 in IntHashtbl.add h 12 "hello" ]} This creates a new module [IntHashtbl], with a new type ['a IntHashtbl.t] of tables from [int] to ['a]. In this example, [h] contains [string] values so its type is [string IntHashtbl.t]. Note that the new type ['a IntHashtbl.t] is not compatible with the type [('a,'b) Hashtbl.t] of the generic interface. For example, [Hashtbl.length h] would not type-check, you must use [IntHashtbl.length]. d?4k4keZ8G8I@@@@@@*HashedTypesDn\8K8Wo\8K8a@b@БA+!tpC~^8j8s^8j8t@@;@@ ,A@@@@@^8j8n@ Q ! The type of the hashtable keys. _8u8y_8u8@@@@@@@@@_@@@A@ `@@@@@@@3@J@A @%equalqa88a88@б@г4!ta88a88@@ @@@ 3@e?9@A@@б@гE!ta88a88@@ @@@ @@г$boola88a88@@ @@@ @@@@@ !@@@'@@ $* @@@a88@ . The equality predicate used to compare keys. b88b88@@@@@@@`@@@ @@@@@@C$hashrd89d89@б@г!t d89d89 @@ @@@ 3@\q8@A@@г#intd89 d89@@ @@@ @@@@@ @@@'d88 @  A hashing function on keys. It must be such that if two keys are equal according to [equal], then they have identical hash values as computed by [hash]. Examples: suitable ([equal], [hash]) pairs for arbitrary key types include - ([(=)], {!hash}) for comparing objects by structure (provided objects do not contain floats) - ([(fun x y -> compare x y = 0)], {!hash}) for comparing objects by structure and handling {!Stdlib.nan} correctly - ([(==)], {!hash}) for comparing objects by physical equality (e.g. for mutable or cyclic objects). 4e995p;r;@@@@@@@Ma@@@H@@@@@@1@A@k@K$@@3FEEFFFFF@8M&@A 3IHHIIIII@@AN]8d8fOq;;@@` - The input signature of the functor {!Make}. ]r;;^r;;@@@@@@@`\8K8K@@!SGjt;;kt;;@{@БA+#keytEzv<< {v<<@@;@@(A@@@@@~v<<@@@@c@@@A@@@3}||}}}}}@. A@@f@@Y:9@99@@@9@9@6%@A@A+!tuFw<<w<<@А!a@ "3@+60;@@ !@A@A@G@B@@@w<<@@@@d@@Aw<<w<<@@s@;@AfA@O@B@@@ @@@@@A@ @@3@@A @&createvx<<'x<<-@б@г#intx<<0x<<3@@ @@@ %3@.> @A@@гB!tx<<:x<<;@А!a@ +G@ &x<<7x<<9@@@ @@@ (@@@"@@ )%@@@x<<#@@e@@@@%%clearwy<<Y%@AZz@A|<<|<<@@@ @@@ < @@г!t|<<|<<@А!a|<<|<<@@@"@@@ > @@@@@ ?!@@@|<<@@h@@@@'#addz}<<}<<@б@гH!t}<<}<<@А!a@ KG@ B3@Fa%@A}<<}<<@@@ @@@ D @@б@г#key}<<}<<@@ @@@ E@@б@А!a#}<<}<<@@гǠ$unit}<<}<<@@ @@@ F-@@@5@@ G0@@@@@ H3! @@@1@@ I64@@@+}<<@@Ci@@@@<&remove{6~<<7~<<@б@г!tA~<<B~<<@А!a@ TG@ L3IHHIIIII@[v%@AO~<<P~<<@@@ @@@ N @@б@г堐#key_~<<`~<<@@ @@@ O@@г$unitl~<<m~<<@@ @@@ P%@@@@@ Q(@@@&@@ R+) @@@z~<<@@j@@@@1$find|<<<<@б@г!t<=<=@А!a@ \G@ U3@Pk%@A<=<=@@@ @@@ W @@б@г4#key<= <= @@ @@@ X@@А!a!<=<=@@@ &@@ Y!@@@@@ Z$"@@@<< @@k@@ @@*(find_opt}====$@б@г9!t==*==+@А!a@ fG@ ]3@Id%@A=='==)@@@ @@@ _ @@б@г|#key==/==2@@ @@@ `@@гb&option==9==?@А!a+& ==6 ==8@@@1@@@ b- @@@@@ c0@@@.@@ d31@@@==@萠- @since 4.05 &=@=D'=@=V@@@@@@@?l@@&@:@@@@@@R(find_all~==X=`>=X=h@б@г!tH=X=nI=X=o@А!a@ pG@ g3POOPPPPP@q>@AV=X=kW=X=m@@@ @@@ i @@б@г점#keyf=X=sg=X=v@@ @@@ j@@г$lists=X=}t=X=@А!a+&z=X=z{=X=|@@@1@@@ l- @@@@@ m0@@@.@@ n31@@@=X=\@@m@@@@9'replace====@б@г!t====@А!a@ zG@ q3@Xs%@A====@@@ @@@ s @@б@гC#key====@@ @@@ t@@б@А!a#====@@г$unit====@@ @@@ u-@@@5@@ v0@@@@@ w3! @@@1@@ x64@@@==@@n@@@@<#mem====@б@гZ!t====@А!a@ G@ {3@[v%@A====@@@ @@@ } @@б@г#key====@@ @@@ ~@@г⠐$bool$==%==@@ @@@ %@@@@@ (@@@&@@ +) @@@2==@@Jo@@@@1$iter===>==@б@б@гР#keyJ==K==@@ @@@ 3LKKLLLLL@Lg!@A@@б@А!a@ G@  ]==^==@@г$unitf==g==@@ @@@ @@@@@ @@@%@@ "( @@б@гܠ!t{==|==@А!a*2====@@@0@@@ 9 @@г=$unit===>@@ @@@ F@@@@@ I@@@,@@ L== @@@==@@p@@@@S2filter_map_inplace>> >>@б@б@г=#key>> >>#@@ @@@ 3@n!@A@@б@А!a@ G@  >>'>>)@@г2&option>>0>>6@А!a>>->>/@@@@@@ $ @@@@@ '@@@-@@ *0@@б@гQ!t>>>>>?@А!a2:>>;>>=@@@8@@@ A @@г$unit>C>I>C>M@@ @@@ N@@@@@ Q@@@,@@ T>> @@@>>@㐠- @since 4.03 !>N>R">N>d@@@@@@@:q@@@5@@@@@@t$fold8>f>n9>f>r@б@б@гˠ#keyE>u>|F>u>@@ @@@ 3GFFGGGGG@:@A@@б@А!a@ G@  X>u>Y>u>@@б@А#acc@ G@ e>u>f>u>@@А#acc  k>u>l>u>@@@@@ % @@@ @@ (@@@.@@ +1 @@б@гࠐ!t>u>>u>@А!a3;>u>>u>@@@9@@@ B @@б@А#acc3H>u>>u>@@А#acc9N>u>>u>@@@>>@@ S @@@@@ V@@@0@@ Y>u>{ @@@>f>j@@r@@@@`&length>>>>@б@г!t>>>>@А!a@ G@ 3@%@A>>>>@@@ @@@  @@г#int>>>>@@ @@@ @@@@@ @@@>> @@s@@ @@%stats>>>>@б@г[!t>>>>@А!a@ G@ 3@>Y%@A>> >>@@@ @@@  @@г *statistics>>>>@@ @@@ @@@@@ @@@!>> @𐠠- @since 4.00 .>>/>?@@@@@@@Gt@@@B@@@@@@8&to_seqE?? F??@б@г!tP??Q??@А!a@ G@ 3XWWXXXXX@Wr>@A^??_??@@@ @@@  @@г#Seq!tp??&q??)@ t??*u??+@@В@г #key????@@ @@@ -@@@А!a83??"??$@@@@@A@@ <@@@3 @@@ A??)@@@@@@ EC,@@@??/@r- @since 4.07 ?,?0?,?B@@@@@@@u@@?@Đ@@@@@@d+to_seq_keys?D?L?D?W@б@г3!t?D?\?D?]@@@@ 3@~9@A?D?Z?D?[@@@ @@@  @@гr#Seq!t?D?e?D?h@ ?D?i?D?j@@г#key?D?a?D?d@@ @@@ )@@@ @@@ . @@@,@@ 1/@@@ ?D?H@ې- @since 4.07 ?k?o?k?@@@@@@@2v@@+@-@@@@@@P-to_seq_values0??1??@б@г!t;??<??@А!a@ G@ 3CBBCCCCC@o>@AI??J??@@@ @@@  @@г#Seq!t[??\??@ _??`??@@А!a% g??h??@@@+@@@ '@@@%@@ *(@@@s??@B- @since 4.07 ????@@@@@@@w@@$@R@@@@@@I'add_seq????@б@г!t????@А!a@ G@ 3@h>@A????@@@ @@@  @@б@гI#Seq!t????@ ????@@В@г]#key????@@ @@@ /@@@А!a:5????@@@@@C@@ >@@@3 @@@ C??)@@г$unit????@@ @@@ Q@@@@@ T@@@R@@ WU @@@??@֐- @since 4.07 ???@ @@@@@@@-x@@@(@@@@@@v+replace_seq+@@,@@"@б@г!t6@@(7@@)@А!a@ G@ 3>==>>>>>@>@AD@@%E@@'@@@ @@@  @@б@г#Seq!tX@@8Y@@;@ \@@<]@@=@@В@г#keyk@@.l@@1@@ @@@ /@@@А!a:5w@@4x@@6@@@@@C@@ >@@@3 @@@ C@@-)@@г:$unit@@A@@E@@ @@@ Q@@@@@ T@@@R@@ WU @@@@@@j- @since 4.07 @F@J@F@\@@@@@@@y@@@z@@@@@@v&of_seq@^@f@^@l@б@гS#Seq!t@^@z@^@}@ @^@~@^@@@В@гg#key@^@p@^@s@@ @@@ 3@O@A@@@А!a@ G@  @^@v@^@x@@@@@@@ @@@: @@@ @^@o0@@гk!t @^@ @^@@А!a"*@^@@^@@@@(@@@ 1 @@@@@ 4@@@@^@b@쐠- @since 4.07 *@@+@@@@@@@@@Cz@@#@>@@@@@@S@A@A@|H@A @@v@o@@@6@@p@i#@@E@%@y@r>@@W@7@`@@@N@@3feefffff@P@A33ihhiiiii@@Anu;;o@@@@> . The output signature of the functor {!Make}. }@@~@@@@@@@@@t;;@3~}}~~~~~@ @A@$MakeH@@@@@~@@Т!HI@@@@@Р 4*HashedType@@@@@3@ & A 6 0A@ A@@~@wC@#@@B@;@@9@2@@)@"@%@@@/@@c@C@?@@@ih@hh@@@h@h@e x@ACB@@УР !S@@@@@3@N`@Y@^ |@c@A  @@ #key@A@A@+ @;@@@Aw!t@@@ @@@@@A@A@@@@'}@@@Aг !H@A @A @@A @@@/@@@@ J;@@@A! @@@ @@@@@@@A@ J; @A@A@ w v@@ @@@ }A@ q@ m@@@  X@@@ @@ @ H@ F@ B@  4@@@  &@@@ @@ @ @ @ @ @@@ @@@ @@ @@@%@@@ )@@@ @@ @@@@3@@@ @S@@@ @g@@@ @@ @@ @@ @S@Q@M@H?@@@ @@@@ '@@@ @@ @@ @@@@Z@@@ @'@@@ @@ @@ @@@@i@@@ @6@@@ @@@ @@ @@ @@z@|l@@@ @I@@@ Tu@@@ @@ @@ @<@:@6@(@@@ @\@@@ @0 @@@ @@ @@ @@ @@@@@@@ @p@@@ @@@ @@ @@ @@@@@~@@@ @@@@ @@ @@ @@@@ w@@@ @@ @@ @e@c@_@@@@@ @LDO@@@ @@ @@ @۠U@@@ @@@ @@ @@ @ @@@@@@ @@@@ @@ @@ @@@@ @@@ @@ @@ @@@@z@@@ l@@@ @@ @^@\@X@ J@@@ <@@@ @@ @.,@@@@@ @@@@ @@@ @@@ @@ @@@2@@@ @@@ @@@ @@ @om_@P@EB@@@ 43H@@@ @@ @@@U@@@ ~@&ܠ@+@@@ }@@@ |@@@ {@@@ z@@ y@@ x@@@su@@@ w@Dgf@I@@@ v@@@ u@@@ t=@@@ s@@ r@@ q@,*@ @\ @a@@@ p@@@ o@@@ n@@@ m@@ l@@@@@O>3@=@A@@@@ I Functor building an implementation of the hashtable structure. The functor [Hashtbl.Make] returns a structure containing a type [key] of keys and a type ['a t] of hash tables associating data of type ['a] to keys of type [key]. The operations perform similarly to those of the generic interface, but use the hashing and equality functions specified in the functor argument [H] instead of generic equality and hashing. Since the hash function is not seeded, the [create] operation of the result structure always returns non-randomized hash tables. AAC;C]@@@@@@@@@@@0SeededHashedTypeLC_CkC_C{@B@БA+!tKCCCC@@;@@A@@@@@CC@␠ ! The type of the hashtable keys.  CC!CC@@@@@@@@@9@@@A@3@@@@@@@3+**+++++@@A@  A@@@@@@@@@@@ut@ed@NM@65@! @@  @@@@@@@3~@~~@@@~@~@{@A]`@%equalxCCyCC@б@гt!tCCCC@@ @@@ 3@[y@A@@б@г!tCCCC@@ @@@ @@г_$boolCCCC@@ @@@ @@@@@ !@@@'@@ $* @@@CC@~ . The equality predicate used to compare keys. CCCD@@@@@@@@@@@А@@@@@@C+seeded_hashDDDD%@б@г#intDD'DD*@@ @@@ 3@\q8@A@@б@гࠐ!tDD.DD/@@ @@@ @@гϠ#intDD3DD6@@ @@@ @@@@@ !@@@'@@ $* @@@ DD@ِ : A seeded hashing function on keys. The first argument is the seed. It must be the case that if [equal x y] is true, then [seeded_hash seed x = seeded_hash seed y] for any value of [seed]. A suitable choice for [seeded_hash] is the function {!Hashtbl.seeded_hash} below. D7D=ERE|@@@@@@@0A@@@+@@@@@@C@A@}@]$@@3)(()))))@J_&@A 3,++,,,,,@@A1C~C2E}E@@C C The input signature of the functor {!MakeSeeded}. @since 4.00 @EEAEE@@@@@@@CC_C_@3A@@AAAAA@@A@'SeededSONEEOEE@g[@БA+#keyM^EE_EE@@;@@ A@@@@@bEE@@@@zC@@@A@@@3a``aaaaa@7k`ZA@@g@@=;:@::@@@:@:@7x@A@A+!tNEFEF@А!a@ 3@+60;@@ @A@A@G@B@@@EE@@@@D@@AEFEF@@W@;@AJA@O@B@@@ @@@@@A@ @@3@@A @&createFF FF@б&randomгv$boolFFCFFG@@ @@@ 3@0@"@A@@б@г#intFKF\FKF_@@ @@@ @@гS!tFKFfFKFg@А!a@ O@ $FKFcFKFe@@@ @@@ +@@@ @@ .#@@?/7@@@  @@ 5FF@@ @FF  @@E@@"@@<%clearFhFpFhFu@б@г!t FhF{ FhF|@А!a@ O@ 3@[r%@AFhFxFhFz@@@ @@@  @@гՠ$unit(FhF)FhF@@ @@@ @@@@@ @@@3FhFl @@KF@@ @@%reset>FF?FF@б@гƠ!tIFFJFF@А!a@ O@ 3QPPQQQQQ@>Y%@AWFFXFF@@@ @@@  @@г$uniteFFfFF@@ @@@ @@@@@ @@@pFF @@G@@ @@$copy{FF|FF@б@г!tFFFF@А!a@ O@ 3@>Y%@AFFFF@@@ @@@  @@г!tFFFF@А!aFFFF@@@"@@@  @@@@@ !@@@FF@@H@@@@'#addFFFF@б@гH!tFFFF@А!a@ O@ 3@Fa%@AFFFF@@@ @@@  @@б@г#keyFFFF@@ @@@ @@б@А!a#FFFF@@г$unitFFFF@@ @@@ -@@@5@@ 0@@@@@ 3! @@@1@@ 64@@@FF@@'I@@@@<&removeFFFF@б@г!t%FF&FF@А!a@ O@ 3-,,-----@[v%@A3FF4FF@@@ @@@  @@б@г堐#keyCFFDFG@@ @@@ @@г$unitPFGQFG @@ @@@ %@@@@@ (@@@&@@ +) @@@^FF@@vJ@@@@1$findiG GjG G@б@г!ttG GuG G@А!a@ "O@ 3|{{|||||@Pk%@AG GG G@@@ @@@  @@б@г4#keyG G"G G%@@ @@@ @@А!a!G G)G G+@@@ &@@ !@@@@@ $"@@@G G @@K@@ @@*(find_optG,G4G,G<@б@г9!tG,GBG,GC@А!a@ ,O@ #3@Id%@AG,G?G,GA@@@ @@@ % @@б@г|#keyG,GGG,GJ@@ @@@ &@@гF&optionG,GQG,GW@А!a+&G,GNG,GP@@@1@@@ (- @@@@@ )0@@@.@@ *31@@@G,G0@̐- @since 4.05  G,GX G,Gj@@@@@@@ #L@@&@ @@@@@@R(find_all !GlGt "GlG|@б@г!t ,GlG -GlG@А!a@ 6O@ -3 4 3 3 4 4 4 4 4@q>@A :GlG ;GlG@@@ @@@ / @@б@г점#key JGlG KGlG@@ @@@ 0@@гӠ$list WGlG XGlG@А!a+& ^GlG _GlG@@@1@@@ 2- @@@@@ 30@@@.@@ 431@@@ mGlGp@@ M@@@@9'replace xGG yGG@б@г!t GG GG@А!a@ @O@ 73        @Xs%@A GG GG@@@ @@@ 9 @@б@гC#key GG GG@@ @@@ :@@б@А!a# GG GG@@г c$unit GG GG@@ @@@ ;-@@@5@@ <0@@@@@ =3! @@@1@@ >64@@@ GG@@ N@@@@<#mem GG GG@б@гZ!t GG GG@А!a@ IO@ A3        @[v%@A GG GG@@@ @@@ C @@б@г#key GG GG@@ @@@ D@@г Ơ$bool!GG! GG@@ @@@ E%@@@@@ F(@@@&@@ G+) @@@!GG@@!.O@@@@1$iter!!GG!"GG@б@б@гР#key!.GG!/GG@@ @@@ J3!0!/!/!0!0!0!0!0@Lg!@A@@б@А!a@ UO@ K !AGG!BGG@@г $unit!JGH!KGH@@ @@@ L@@@@@ M@@@%@@ N"( @@б@гܠ!t!_GH !`GH@А!a*2!fGH !gGH @@@0@@@ P9 @@г!!$unit!tGH!uGH@@ @@@ QF@@@@@ RI@@@,@@ SL!GG @@@!GG@@!P@@@@S2filter_map_inplace!HH!HH1@б@б@г=#key!HH4!HH7@@ @@@ V3!!!!!!!!@n!@A@@б@А!a@ bO@ W !HH;!HH=@@г!&option!HHD!HHJ@А!a!HHA!HHC@@@@@@ Y$ @@@@@ Z'@@@-@@ [*0@@б@гQ!t!HHR!HHS@А!a2:!HHO!HHQ@@@8@@@ ]A @@г!$unit!HWH]!HWHa@@ @@@ ^N@@@@@ _Q@@@,@@ `T!HH3 @@@!HH@ǐ- @since 4.03 "HbHf"HbHx@@@@@@@"Q@@@"@@@@@@t$fold"HzH"HzH@б@б@гˠ#key")HH"*HH@@ @@@ c3"+"*"*"+"+"+"+"+@:@A@@б@А!a@ oO@ d "<HH"=HH@@б@А#acc@ qO@ e"IHH"JHH@@А#acc  "OHH"PHH@@@@@ f% @@@ @@ g(@@@.@@ h+1 @@б@гࠐ!t"cHH"dHH@А!a3;"jHH"kHH@@@9@@@ jB @@б@А#acc3H"wHH"xHH@@А#acc9N"}HH"~HH@@@>>@@ kS @@@@@ lV@@@0@@ mY"HH @@@"HzH~@@"R@@@@`&length"HH"HH@б@г!t"HH"HH@А!a@ xO@ r3""""""""@%@A"HH"HH@@@ @@@ t @@г"#int"HH"HH@@ @@@ u@@@@@ v@@@"HH @@"S@@ @@%stats"HH"HH@б@г[!t"HH"HH@А!a@ O@ y3""""""""@>Y%@A"HH"HH@@@ @@@ { @@гh*statistics"HH"HI@@ @@@ |@@@@@ }@@@#HH @@#T@@ @@&to_seq#II #II@б@г!t#II#II@А!a@ O@ 3###"#"##########@>Y%@A#)II#*II@@@ @@@  @@г!#Seq!t#;II'#<II*@ #?II+#@II,@@В@г#key#NII#OII @@ @@@ -@@@А!a83#ZII##[II%@@@@@A@@ <@@@3 @@@ A#hII)@@@@@@ EC,@@@#nII/@!=- @since 4.07 #{I-I1#|I-IC@@@@@@@#U@@?@!M#@@@@@@d+to_seq_keys#IEIM#IEIX@б@г!t#IEI]#IEI^@@@@ 3########@~9@A#IEI[#IEI\@@@ @@@  @@г"=#Seq!t#IEIf#IEIi@ #IEIj#IEIk@@гi#key#IEIb#IEIe@@ @@@ )@@@ @@@ . @@@,@@ 1/@@@#IEII@!- @since 4.07 #IlIp#IlI@@@@@@@#V@@+@!#@@@@@@P-to_seq_values#II#II@б@г!t$II$II@А!a@ O@ 3$$ $ $$$$$@o>@A$II$II@@@ @@@  @@г"#Seq!t$&II$'II@ $*II$+II@@А!a% $2II$3II@@@+@@@ '@@@%@@ *(@@@$>II@" - @since 4.07 $KII$LII@@@@@@@$dW@@$@"$_@@@@@@I'add_seq$bII$cII@б@гꠐ!t$mII$nII@А!a@ O@ 3$u$t$t$u$u$u$u$u@h>@A${II$|II@@@ @@@  @@б@г##Seq!t$II$II@ $II$II@@В@гD#key$II$II@@ @@@ /@@@А!a:5$II$II@@@@@C@@ >@@@3 @@@ C$II)@@г$q$unit$II$II@@ @@@ Q@@@@@ T@@@R@@ WU @@@$II@"- @since 4.07 $II$IJ@@@@@@@$X@@@"$󐠠@@@@@@v+replace_seq $JJ$JJ#@б@г~!t%JJ)%JJ*@А!a@ O@ 3% %%% % % % % @>@A%JJ&%JJ(@@@ @@@  @@б@г##Seq!t%#JJ9%$JJ<@ %'JJ=%(JJ>@@В@гؠ#key%6JJ/%7JJ2@@ @@@ /@@@А!a:5%BJJ5%CJJ7@@@@@C@@ >@@@3 @@@ C%PJJ.)@@г%$unit%XJJ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@&@@@@ ~@\@@@ }@ @@@ |@@ {@@ z@@ y@@@@@@@ x@p@@@ w@@@ v@@ u@@ t@@@@@~@@@ s@@@@ r@@ q@@ p@@@@ og@@@ n@@ m@@ l@U@S@O@@@@@ k@<4?@@@ j@@ i@@ h@۠E@@@ g @@@ f@@ e@@ d@@@@@@@ c@@@@ b@@ a@@ `@@@@ _@@@ ^@@ ]@@ \@~@|@x@j@@@ [\@@@ Z@@ Y@N@L@H@ :@@@ X,@@@ W@@ V@@@@ @@@ U&@@@@ T@@@ S@@@ R@@ Q@@@2@@@ P&@@@ O@@@ N@@ M@xvh@Y@EK@@@ L&=<Q@@@ K@@ J@!@@U@@@ I@&@+@@@ H@@@ G@@@ F@@@ E@@ D@@ C@@@s~@@@ B@'po@I@@@ A@@@ @@@@ ?F@@@ >@@ =@@ <@53%@@'0@a@@@ ;@@@ :@@@ 9@@@ 8@@ 7@@@@@XG3((((((((@F@A(JK@@&(ɐ  Functor building an implementation of the hashtable structure. The functor [Hashtbl.MakeSeeded] returns a structure containing a type [key] of keys and a type ['a t] of hash tables associating data of type ['a] to keys of type [key]. The operations perform similarly to those of the generic interface, but use the seeded hashing and equality functions specified in the functor argument [H] instead of generic equality and hashing. The [create] operation of the result structure supports the [~random] optional parameter and returns randomized hash tables if [~random:true] is passed or if randomization is globally on (see {!Hashtbl.randomize}). @since 4.00 (K8K8(MM@@@@@@@(JJ@@((ݐ $ {1 The polymorphic hash functions} (NN(NN)@@@@@@3((((((((@m@zA@A@@@@@@@@@rq@a`@ON@?>@('@@@@@@@@@wv@@&ᐠYX@XX@@@X@X@U@AD$hash)%N,N0)&N,N4@б@А!a@ S@ U)2N,N7)3N,N9@@г)#int);N,N=)<N,N@@@ @@@ d@@@@@ g@@@)FN,N, @' [Hashtbl.hash x] associates a nonnegative integer to any value of any type. It is guaranteed that if [x = y] or [Stdlib.compare x y = 0], then [hash x = hash y]. Moreover, [hash] always terminates, even on cyclic structures. )SNANA)TNO1@@@@@@@)l_@@@'%)g@@@@@@+seeded_hash)j O3O7)k O3OB@б@г)H#int)u O3OE)v O3OH@@ @@@ 3)w)v)v)w)w)w)w)w@[8@A@@б@А!a@ S@  ) O3OL) O3ON@@г)d#int) O3OR) O3OU@@ @@@ @@@@@ @@@%@@ "( @@@) O3O3@'n Z A variant of {!hash} that is further parameterized by an integer seed. @since 4.00 ) OVOV) OO@@@@@@@)`@@@'~)@@@@@@A*hash_param)OO)OO@б@г)#int)OO)OO@@ @@@ 3))))))))@Zo8@A@@б@г)#int)OO)OO@@ @@@ @@б@А!a@ S@ )OO)OO@@г)̠#int)OO)OO@@ @@@ +@@@@@ .@@@#@@ 1& @@@7@@ 4:@@@* OO@'ِ & [Hashtbl.hash_param meaningful total x] computes a hash value for [x], with the same properties as for [hash]. The two extra integer parameters [meaningful] and [total] give more precise control over hashing. Hashing performs a breadth-first, left-to-right traversal of the structure [x], stopping after [meaningful] meaningful nodes were encountered, or [total] nodes (meaningful or not) were encountered. If [total] as specified by the user exceeds a certain value, currently 256, then it is capped to that value. Meaningful nodes are: integers; floating-point numbers; strings; characters; booleans; and constant constructors. Larger values of [meaningful] and [total] means that more nodes are taken into account to compute the final hash value, and therefore collisions are less likely to happen. However, hashing takes longer. The parameters [meaningful] and [total] govern the tradeoff between accuracy and speed. As default choices, {!hash} and {!seeded_hash} take [meaningful = 10] and [total = 100]. *OO* ST @@@@@@@*0a@@!@'*+@@@@@@S1seeded_hash_param*."T T*/"T T"@б@г* #int*9"T T%*:"T T(@@ @@@ 3*;*:*:*;*;*;*;*;@l8@A@@б@г*#int*J"T T,*K"T T/@@ @@@ @@б@г*,#int*Y"T T3*Z"T T6@@ @@@  @@б@А!a@ S@ +*j"T T:*k"T T<@@г*F#int*s"T T@*t"T TC@@ @@@ :@@@@@ =@@@#@@ @& @@@5@@ C8@@@I@@ FL@@@*"T T @(V A variant of {!hash_param} that is further parameterized by an integer seed. Usage: [Hashtbl.seeded_hash_param meaningful total seed x]. @since 4.00 *#TDTD*&TT@@@@@@@*b@@$@(f*@@@@@@e** {1:examples Examples} {2 Basic Example} {[ (* 0...99 *) let seq = Seq.ints 0 |> Seq.take 100 (* build from Seq.t *) # let tbl = seq |> Seq.map (fun x -> x, string_of_int x) |> Hashtbl.of_seq val tbl : (int, string) Hashtbl.t = # Hashtbl.length tbl - : int = 100 # Hashtbl.find_opt tbl 32 - : string option = Some "32" # Hashtbl.find_opt tbl 166 - : string option = None # Hashtbl.replace tbl 166 "one six six" - : unit = () # Hashtbl.find_opt tbl 166 - : string option = Some "one six six" # Hashtbl.length tbl - : int = 101 ]} {2 Counting Elements} Given a sequence of elements (here, a {!Seq.t}), we want to count how many times each distinct element occurs in the sequence. A simple way to do this, assuming the elements are comparable and hashable, is to use a hash table that maps elements to their number of occurrences. Here we illustrate that principle using a sequence of (ascii) characters (type [char]). We use a custom [Char_tbl] specialized for [char]. {[ # module Char_tbl = Hashtbl.Make(struct type t = char let equal = Char.equal let hash = Hashtbl.hash end) (* count distinct occurrences of chars in [seq] *) # let count_chars (seq : char Seq.t) : _ list = let counts = Char_tbl.create 16 in Seq.iter (fun c -> let count_c = Char_tbl.find_opt counts c |> Option.value ~default:0 in Char_tbl.replace counts c (count_c + 1)) seq; (* turn into a list *) Char_tbl.fold (fun c n l -> (c,n) :: l) counts [] |> List.sort (fun (c1,_)(c2,_) -> Char.compare c1 c2) val count_chars : Char_tbl.key Seq.t -> (Char.t * int) list = (* basic seq from a string *) # let seq = String.to_seq "hello world, and all the camels in it!" val seq : char Seq.t = # count_chars seq - : (Char.t * int) list = [(' ', 7); ('!', 1); (',', 1); ('a', 3); ('c', 1); ('d', 2); ('e', 3); ('h', 2); ('i', 2); ('l', 6); ('m', 1); ('n', 2); ('o', 2); ('r', 1); ('s', 1); ('t', 2); ('w', 1)] (* "abcabcabc..." *) # let seq2 = Seq.cycle (String.to_seq "abc") |> Seq.take 31 val seq2 : char Seq.t = # String.of_seq seq2 - : String.t = "abcabcabcabcabcabcabcabcabcabca" # count_chars seq2 - : (Char.t * int) list = [('a', 11); ('b', 10); ('c', 10)] ]} *(TT*^^@@@@@@3********@w1@A@((fA@(P'@''@'r'0@'&@&&E@&%%@%%j@%J$@$$@$h$@##@##@""@"e!@!!@!k!D@!$ @  q@ P JA@7@]@=@@a@O@/@e@u@n@h@@   @ Z @@N:@@@i@I@@@3++++++++@V@A@ H************************************************************************+A@@+A@L@ H +BMM+BM@ H OCaml +C+C@ H +!D+"D3@ H Xavier Leroy, projet Cristal, INRIA Rocquencourt +'E44+(E4@ H +-F+.F@ H Copyright 1996 Institut National de Recherche en Informatique et +3G+4G@ H en Automatique. +9H+:Hg@ H +?Ihh+@Ih@ H All rights reserved. This file is distributed under the terms of +EJ+FJ@ H the GNU Lesser General Public License version 2.1, with the +KK+LKN@ H special exception on linking described in the file LICENSE. +QLOO+RLO@ H +WM+XM@ H************************************************************************+]N+^N5@ NOTE: If this file is hashtbl.mli, do not edit it directly! Instead, edit templates/hashtbl.template.mli and run tools/sync_stdlib_docs +cP77+dQ@ h* Hash tables and hash functions. Hash tables are hashed association tables, with in-place modification. Because most operations on a hash table modify their input, they're more commonly used in imperative code. The lookup of the value associated with a key (see {!find}, {!find_opt}) is normally very fast, often faster than the equivalent lookup in {!Map}. The functors {!Make} and {!MakeSeeded} can be used when performance or flexibility are key. The user provides custom equality and hash functions for the key type, and obtains a custom hash table type for this particular type of key. {b Warning} a hash table is only as good as the hash function. A bad hash function will turn the table into a degenerate association list, with linear time lookup instead of constant time lookup. The polymorphic {!t} hash table is useful in simpler cases or in interactive environments. It uses the polymorphic {!hash} function defined in the OCaml runtime (at the time of writing, it's SipHash), as well as the polymorphic equality [(=)]. See {{!examples} the examples section}. +i>* {b Unsynchronized accesses} )栠 * Unsynchronized accesses to a hash table may lead to an invalid hash table state. Thus, concurrent accesses to a hash tables must be synchronized (for instance with a {!Mutex.t}). )s8* {1 Generic interface} )e 7* The type of hash tables from type ['a] to type ['b]. )5? thwart tools/sync_stdlib_docs +xA ! 7+yA ! Z@ <* [Hashtbl.create n] creates a new, empty hash table, with initial size greater or equal to the suggested size [n]. For best results, [n] should be on the order of the expected number of elements that will be in the table. The table grows as needed, so [n] is just an initial guess. If [n] is very small or negative then it is disregarded and a small default size is used. The optional [~random] parameter (a boolean) controls whether the internal organization of the hash table is randomized at each execution of [Hashtbl.create] or deterministic over all executions. A hash table that is created with [~random] set to [false] uses a fixed hash function ({!hash}) to distribute keys among buckets. As a consequence, collisions between keys happen deterministically. In Web-facing applications or other security-sensitive applications, the deterministic collision patterns can be exploited by a malicious user to create a denial-of-service attack: the attacker sends input crafted to create many collisions in the table, slowing the application down. A hash table that is created with [~random] set to [true] uses the seeded hash function {!seeded_hash} with a seed that is randomly chosen at hash table creation time. In effect, the hash function used is randomly selected among [2^{30}] different hash functions. All these hash functions have different collision patterns, rendering ineffective the denial-of-service attack described above. However, because of randomization, enumerating all elements of the hash table using {!fold} or {!iter} is no longer deterministic: elements are enumerated in different orders at different runs of the program. If no [~random] parameter is given, hash tables are created in non-random mode by default. This default can be changed either programmatically by calling {!randomize} or by setting the [R] flag in the [OCAMLRUNPARAM] environment variable. @before 4.00 the [~random] parameter was not present and all hash tables were created in non-randomized mode. ( u* Empty a hash table. Use [reset] instead of [clear] to shrink the size of the bucket table to its initial size. (H f* Empty a hash table and shrink the size of the bucket table to its initial size. @since 4.00 '砠 (* Return a copy of the given hashtable. 'u * [Hashtbl.add tbl key data] adds a binding of [key] to [data] in table [tbl]. {b Warning}: Previous bindings for [key] are not removed, but simply hidden. That is, after performing {!remove}[ tbl key], the previous binding for [key], if any, is restored. (Same behavior as with association lists.) If you desire the classic behavior of replacing elements, see {!replace}. & x* [Hashtbl.find tbl x] returns the current binding of [x] in [tbl], or raises [Not_found] if no such binding exists. & * [Hashtbl.find_opt tbl x] returns the current binding of [x] in [tbl], or [None] if no such binding exists. @since 4.05 &% * [Hashtbl.find_all tbl x] returns the list of all data associated with [x] in [tbl]. The current binding is returned first, then the previous bindings, in reverse order of introduction in the table. % 7* [Hashtbl.mem tbl x] checks if [x] is bound in [tbl]. %E * [Hashtbl.remove tbl x] removes the current binding of [x] in [tbl], restoring the previous binding if it exists. It does nothing if [x] is not bound in [tbl]. $٠ &* [Hashtbl.replace tbl key data] replaces the current binding of [key] in [tbl] by a binding of [key] to [data]. If [key] is unbound in [tbl], a binding of [key] to [data] is added to [tbl]. This is functionally equivalent to {!remove}[ tbl key] followed by {!add}[ tbl key data]. $b J* [Hashtbl.iter f tbl] applies [f] to all bindings in table [tbl]. [f] receives the key as first argument, and the associated value as second argument. Each binding is presented exactly once to [f]. The order in which the bindings are passed to [f] is unspecified. However, if the table contains several bindings for the same key, they are passed to [f] in reverse order of introduction, that is, the most recent binding is passed first. If the hash table was created in non-randomized mode, the order in which the bindings are enumerated is reproducible between successive runs of the program, and even between minor versions of OCaml. For randomized hash tables, the order of enumeration is entirely random. The behavior is not specified if the hash table is modified by [f] during the iteration. #ؠ a* [Hashtbl.filter_map_inplace f tbl] applies [f] to all bindings in table [tbl] and update each binding depending on the result of [f]. If [f] returns [None], the binding is discarded. If it returns [Some new_val], the binding is update to associate the key to [new_val]. Other comments for {!iter} apply as well. @since 4.03 #F d* [Hashtbl.fold f tbl init] computes [(f kN dN ... (f k1 d1 init)...)], where [k1 ... kN] are the keys of all bindings in [tbl], and [d1 ... dN] are the associated values. Each binding is presented exactly once to [f]. The order in which the bindings are passed to [f] is unspecified. However, if the table contains several bindings for the same key, they are passed to [f] in reverse order of introduction, that is, the most recent binding is passed first. If the hash table was created in non-randomized mode, the order in which the bindings are enumerated is reproducible between successive runs of the program, and even between minor versions of OCaml. For randomized hash tables, the order of enumeration is entirely random. The behavior is not specified if the hash table is modified by [f] during the iteration. " * [Hashtbl.length tbl] returns the number of bindings in [tbl]. It takes constant time. Multiple bindings are counted once each, so [Hashtbl.length] gives the number of times [Hashtbl.iter] calls its first argument. "N ?* After a call to [Hashtbl.randomize()], hash tables are created in randomized mode by default: {!create} returns randomized hash tables, unless the [~random:false] optional parameter is given. The same effect can be achieved by setting the [R] parameter in the [OCAMLRUNPARAM] environment variable. It is recommended that applications or Web frameworks that need to protect themselves against the denial-of-service attack described in {!create} call [Hashtbl.randomize()] at initialization time before any domains are created. Note that once [Hashtbl.randomize()] was called, there is no way to revert to the non-randomized default behavior of {!create}. This is intentional. Non-randomized hash tables can still be created using [Hashtbl.create ~random:false]. @since 4.00 " z* Return [true] if the tables are currently created in randomized mode by default, [false] otherwise. @since 4.03 ! ? thwart tools/sync_stdlib_docs +))+)*@ * Return a copy of the given hashtable. Unlike {!copy}, {!rebuild}[ h] re-hashes all the (key, value) entries of the original table [h]. The returned hash table is randomized if [h] was randomized, or the optional [random] parameter is true, or if the default is to create randomized hash tables; see {!create} for more information. {!rebuild} can safely be used to import a hash table built by an old version of the {!Hashtbl} module, then marshaled to persistent storage. After unmarshaling, apply {!rebuild} to produce a hash table for the current version of the {!Hashtbl} module. @since 4.12 !=.* @since 4.00  X* Number of bindings present in the table. Same value as returned by {!length}. ! "* Number of buckets in the table.  )* Maximal number of bindings per bucket.  ⠠ * Histogram of bucket sizes. This array [histo] has length [max_bucket_length + 1]. The value of [histo.(i)] is the number of buckets whose size is [i].  Ơ * [Hashtbl.stats tbl] returns statistics about the table [tbl]: number of buckets, size of the biggest bucket, distribution of buckets by size. @since 4.00 Ϡ * {1 Hash tables and Sequences}  * Iterate on the whole table. The order in which the bindings appear in the sequence is unspecified. However, if the table contains several bindings for the same key, they appear in reversed order of introduction, that is, the most recent binding appears first. The behavior is not specified if the hash table is modified during the iteration. @since 4.07 ; 3* Same as [Seq.map fst (to_seq m)] @since 4.07 Π 3* Same as [Seq.map snd (to_seq m)] @since 4.07 a D* Add the given bindings to the table, using {!add} @since 4.07 ɠ H* Add the given bindings to the table, using {!replace} @since 4.07 1 * Build a table from the given bindings. The bindings are added in the same order they appear in the sequence, using {!replace_seq}, which means that if two pairs have the same key, only the latest one will appear in the table. @since 4.07 ;* {1 Functorial interface}  * The functorial interface allows the use of specific comparison and hash functions, either for performance/security concerns, or because keys are not hashable/comparable with the polymorphic builtins. For instance, one might want to specialize a table for integer keys: {[ module IntHash = struct type t = int let equal i j = i=j let hash i = i land max_int end module IntHashtbl = Hashtbl.Make(IntHash) let h = IntHashtbl.create 17 in IntHashtbl.add h 12 "hello" ]} This creates a new module [IntHashtbl], with a new type ['a IntHashtbl.t] of tables from [int] to ['a]. In this example, [h] contains [string] values so its type is [string IntHashtbl.t]. Note that the new type ['a IntHashtbl.t] is not compatible with the type [('a,'b) Hashtbl.t] of the generic interface. For example, [Hashtbl.length h] would not type-check, you must use [IntHashtbl.length].  "* The type of the hashtable keys. X /* The equality predicate used to compare keys.  * A hashing function on keys. It must be such that if two keys are equal according to [equal], then they have identical hash values as computed by [hash]. Examples: suitable ([equal], [hash]) pairs for arbitrary key types include - ([(=)], {!hash}) for comparing objects by structure (provided objects do not contain floats) - ([(fun x y -> compare x y = 0)], {!hash}) for comparing objects by structure and handling {!Stdlib.nan} correctly - ([(==)], {!hash}) for comparing objects by physical equality (e.g. for mutable or cyclic objects).  .* The input signature of the functor {!Make}. .* @since 4.00 s.* @since 4.05 Р.* @since 4.03 ؠ.* @since 4.00 Π.* @since 4.07 O.* @since 4.07 頠.* @since 4.07 .* @since 4.07 .* @since 4.07 c.* @since 4.07 䠠 /* The output signature of the functor {!Make}.  J* Functor building an implementation of the hashtable structure. The functor [Hashtbl.Make] returns a structure containing a type [key] of keys and a type ['a t] of hash tables associating data of type ['a] to keys of type [key]. The operations perform similarly to those of the generic interface, but use the hashing and equality functions specified in the functor argument [H] instead of generic equality and hashing. Since the hash function is not seeded, the [create] operation of the result structure always returns non-randomized hash tables. " "* The type of the hashtable keys.  /* The equality predicate used to compare keys. ^ ;* A seeded hashing function on keys. The first argument is the seed. It must be the case that if [equal x y] is true, then [seeded_hash seed x = seeded_hash seed y] for any value of [seed]. A suitable choice for [seeded_hash] is the function {!Hashtbl.seeded_hash} below.  D* The input signature of the functor {!MakeSeeded}. @since 4.00 ࠠ? thwart tools/sync_stdlib_docs ,#FF,$FFA@.* @since 4.05  .* @since 4.03  '.* @since 4.07 .* @since 4.07 N.* @since 4.07 ꠠ.* @since 4.07 Y.* @since 4.07 Ƞ.* @since 4.07 I E* The output signature of the functor {!MakeSeeded}. @since 4.00  * Functor building an implementation of the hashtable structure. The functor [Hashtbl.MakeSeeded] returns a structure containing a type [key] of keys and a type ['a t] of hash tables associating data of type ['a] to keys of type [key]. The operations perform similarly to those of the generic interface, but use the seeded hashing and equality functions specified in the functor argument [H] instead of generic equality and hashing. The [create] operation of the result structure supports the [~random] optional parameter and returns randomized hash tables if [~random:true] is passed or if randomization is globally on (see {!Hashtbl.randomize}). @since 4.00 ~ %* {1 The polymorphic hash functions} m * [Hashtbl.hash x] associates a nonnegative integer to any value of any type. It is guaranteed that if [x = y] or [Stdlib.compare x y = 0], then [hash x = hash y]. Moreover, [hash] always terminates, even on cyclic structures.  [* A variant of {!hash} that is further parameterized by an integer seed. @since 4.00  '* [Hashtbl.hash_param meaningful total x] computes a hash value for [x], with the same properties as for [hash]. The two extra integer parameters [meaningful] and [total] give more precise control over hashing. Hashing performs a breadth-first, left-to-right traversal of the structure [x], stopping after [meaningful] meaningful nodes were encountered, or [total] nodes (meaningful or not) were encountered. If [total] as specified by the user exceeds a certain value, currently 256, then it is capped to that value. Meaningful nodes are: integers; floating-point numbers; strings; characters; booleans; and constant constructors. Larger values of [meaningful] and [total] means that more nodes are taken into account to compute the final hash value, and therefore collisions are less likely to happen. However, hashing takes longer. The parameters [meaningful] and [total] govern the tradeoff between accuracy and speed. As default choices, {!hash} and {!seeded_hash} take [meaningful = 10] and [total = 100]. 9 * A variant of {!hash_param} that is further parameterized by an integer seed. Usage: [Hashtbl.seeded_hash_param meaningful total seed x]. @since 4.00  * {1:examples Examples} {2 Basic Example} {[ (* 0...99 *) let seq = Seq.ints 0 |> Seq.take 100 (* build from Seq.t *) # let tbl = seq |> Seq.map (fun x -> x, string_of_int x) |> Hashtbl.of_seq val tbl : (int, string) Hashtbl.t = # Hashtbl.length tbl - : int = 100 # Hashtbl.find_opt tbl 32 - : string option = Some "32" # Hashtbl.find_opt tbl 166 - : string option = None # Hashtbl.replace tbl 166 "one six six" - : unit = () # Hashtbl.find_opt tbl 166 - : string option = Some "one six six" # Hashtbl.length tbl - : int = 101 ]} {2 Counting Elements} Given a sequence of elements (here, a {!Seq.t}), we want to count how many times each distinct element occurs in the sequence. A simple way to do this, assuming the elements are comparable and hashable, is to use a hash table that maps elements to their number of occurrences. Here we illustrate that principle using a sequence of (ascii) characters (type [char]). We use a custom [Char_tbl] specialized for [char]. {[ # module Char_tbl = Hashtbl.Make(struct type t = char let equal = Char.equal let hash = Hashtbl.hash end) (* count distinct occurrences of chars in [seq] *) # let count_chars (seq : char Seq.t) : _ list = let counts = Char_tbl.create 16 in Seq.iter (fun c -> let count_c = Char_tbl.find_opt counts c |> Option.value ~default:0 in Char_tbl.replace counts c (count_c + 1)) seq; (* turn into a list *) Char_tbl.fold (fun c n l -> (c,n) :: l) counts [] |> List.sort (fun (c1,_)(c2,_) -> Char.compare c1 c2) val count_chars : Char_tbl.key Seq.t -> (Char.t * int) list = (* basic seq from a string *) # let seq = String.to_seq "hello world, and all the camels in it!" val seq : char Seq.t = # count_chars seq - : (Char.t * int) list = [(' ', 7); ('!', 1); (',', 1); ('a', 3); ('c', 1); ('d', 2); ('e', 3); ('h', 2); ('i', 2); ('l', 6); ('m', 1); ('n', 2); ('o', 2); ('r', 1); ('s', 1); ('t', 2); ('w', 1)] (* "abcabcabc..." *) # let seq2 = Seq.cycle (String.to_seq "abc") |> Seq.take 31 val seq2 : char Seq.t = # String.of_seq seq2 - : String.t = "abcabcabcabcabcabcabcabcabcabca" # count_chars seq2 - : (Char.t * int) list = [('a', 11); ('b', 10); ('c', 10)] ]} @?)../ocamlc0-strict-sequence(-absname"-w5+a-4-9-41-42-44-45-48"-g+-warn-error"+A*-bin-annot)-nostdlib*-principal"-o3stdlib__Hashtbl.cmi"-c,c,d D/builds/workspace/precheck/flambda/false/label/ocaml-linux-32/stdlib @@0~a;2@vC3,h,g,g,h,h,h,h,h@,f@@8CamlinternalFormatBasics0%FU(Q/Tu&Stdlib0Lku]8_٠.Stdlib__Either0Vy`u~c à,0ѱN][/!+Stdlib__Seq0nwzG&amg@0ѱN][/!Aa&' @  z@7Apm@@ #$.@@ n@~*u;C@  7@=E !'D'()@@hF/@ 7 ##R@@  NF"ِ#@t{@@@>W@@ T ǰ)*m@eZe@ | @'(@@[##@@ʐ&@  U"!@Zd@6R@x@Ð**@@2@@ e ݰ"4!@@  2!!@@%ǐ&2@Sư&E&@  ^c@  A*c"b!@@A"#@@.@@P" "@()@@))@  ưG@@@ɰ$Ӑ%Y@@ Ő &'B@@@֒? 7 @%v%@`  -@**c@@P@@