Caml1999I037 s-Stdlib__Queue!t;!a@@A@A@O@B@@@)queue.mlibb@@@@@@A@ %Empty##exnG@@@A&_none_@@A@ A@B@&create@$unitF@@@-!a@@@@@@@(j)j@@:B@@#add@!a@@ @@@$@@@@@@@@AmBm@@SC@@$push@!a@@3 @@@=@@@@@@@@Zpbb[pb@@lD@@$take@F!a@@@@@@@msns@@E@@(take_opt@Y!a@@@@&optionL @@@@@@w//w/O@@F@@#pop@s!a@@@@@@@||@@G@@$peek@!a@@@@@@@    %@@H@@(peek_opt@!a@@@@@ @@@@@@C  C  @@I@@#top@!a@@@@@@@H m mH m @@J@@$drop@Ġ!a@@@@@@@@@@K  K  @@K@@%clear@۠!a@@@@@@@@@@P 5 5P 5 M@@L@@$copy@!a@@@@@@@@@@S y yS y @@/M@@(is_empty@ !a@@@@$boolE@@@@@@6V  7V  @@HN@@&length@"!a@@@@#intA@@@@@@OY  PY  5@@aO@@$iter@@!a@G@@@@@@G @@@Q@@@@@@@@n\ h ho\ h @@P@@$fold@@#acc@@!a@ @@@@@ @j @@@@@@@@@@a 2 2a 2 i@@Q@@(transfer@y!a@@@@@ @@@@@@@@@@@f  f @@R@@&to_seq@!a@@@@&Stdlib#Seq!t@@@@@@nn$@@S@@'add_seq@!a@@@@@ #Seq!t@@@@@@@@@@@tt@@T@@&of_seq@7#Seq!t!a@@@@@@@@@@x99x9V@@U@@@_L-Stdlib__Queue0/~7[YH+Stdlib__Seq0nwzG&amg.Stdlib__Either0Vy`u~c à&Stdlib0Lku]8_٠8CamlinternalFormatBasics0%FU(Q/Tu@Y"@5unsynchronized_access :Unsynchronized accesses to queues are a programming error.@A@Caml1999T037] 4Q.C-Stdlib__Queue*ocaml.text&_none_@@A First-in first-out queues. This module implements queues (FIFOs), with in-place modification. See {{!examples} the example section} below. )queue.mliP77T@@@@@@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} VV@@@@@@%alertXX@5unsynchronized_accessXX@@@@@ :Unsynchronized accesses to queues are a programming error.YYT@@YYU@@@@@@@@@@XZVW@@Ő Unsynchronized accesses to a queue may lead to an invalid queue state. Thus, concurrent accesses to queues must be synchronized (for instance with a {!Mutex.t}). \YY`  @@@@@@A+!tAbb@А!a@3@;@@@A@A@G@B@@@b@)ocaml.doc󐠠 6 The type of queues containing elements of type ['a]. ccU@@@@@@@@@ @@@Abb@@B@@;%@A@A@O@B@@@@@ @@A@ @@@@@@@':@%EmptyBfXbfXg@#.@@@AfXX@5 J Raised when {!Queue.take} or {!Queue.peek} is applied to an empty queue. #ghh$gh@@@@@@@@A $@&create>j?j@б@г$unitIjJj@@ @@@3KJJKKKKK@C=@A@@г!tXjYj@А!a@C@djej@@@ @@@@@@"@@%@@@pj@ & Return a new queue, initially empty. }k~k@@@@@@@B@@(@@@@@@@>#addmm@б@А!a@C@3@Sh4@Am m @@б@г᠐!tmm@А!amm@@@@@@ @@гp$unitmm@@ @@@(@@@@@+@@@3@@., @@@m@𐠠 = [add x q] adds the element [x] at the end of the queue [q]. nn`@@@@@@@C@@@򐠠@@@@@@M$pushpbfpbj@б@А!a@C@3@bs4@Apbmpbo@@б@гB!tpbvpbw@А!apbspbu@@@@@@ @@гѠ$unit$pb{%pb@@ @@@(@@@@@+@@@3@@., @@@2pbb@Q [push] is a synonym for [add]. ?q@q@@@@@@@XD@@@aS@@@@@@M$takeVsWs@б@г!tasbs@А!a@C@3ihhiiiii@l}>@Aosps@@@ @@@ @@А!a zs{s@@@ @@@@@s@ k [take q] removes and returns the first element in queue [q], or raises {!Empty} if the queue is empty. tu-@@@@@@@E@@@@@@@@@1(take_optw/3w/;@б@г㠐!tw/Aw/B@А!a@C@3@Pk>@Aw/>w/@@@@ @@@ @@г+&optionw/Iw/O@А!aw/Fw/H@@@"@@@ @@@@@!@@@w//@ } [take_opt q] removes and returns the first element in queue [q], or returns [None] if the queue is empty. @since 4.08 xPPz@@@@@@@F@@#@@@@@@@@#pop||@б@гA!t||@А!a@C@3@_z>@A||@@@ @@@ @@А!a '|(|@@@ @@@@@.|@M [pop] is a synonym for [take]. ;}<} @@@@@@@TG@@@]O@@@@@@1$peekR  S  @б@г!t]  ^  @А!a@C@3eddeeeee@Pk>@Ak  l  @@@ @@@ @@А!a v  #w  %@@@ @@@@@}  @ [peek q] returns the first element in queue [q], without removing it from the queue, or raises {!Empty} if the queue is empty. @ & &A l @@@@@@@H@@@@@@@@@1(peek_optC  C  @б@гߠ!tC  C  @А!a@C@3@Pk>@AC  C  @@@ @@@ @@г'&optionC  C  @А!aC  C  @@@"@@@ @@@@@!@@@C  @ [peek_opt q] returns the first element in queue [q], without removing it from the queue, or returns [None] if the queue is empty. @since 4.08 D  F Z k@@@@@@@I@@#@ @@@@@@@#topH m qH m t@б@г=!t H m z H m {@А!a@C@3@_z>@AH m wH m y@@@ @@@ @@А!a #H m $H m @@@ @@@@@*H m m@I [top] is a synonym for [peek]. 7I  8I  @@@@@@@PJ@@@YK@@@@@@1$dropNK  OK  @б@г!tYK  ZK  @А!a@C@3a``aaaaa@Pk>@AgK  hK  @@@ @@@ @@г"$unituK  vK  @@ @@@@@@@@@@@K   @ m [drop q] removes the first element in queue [q], or raises {!Empty} if the queue is empty. @since 5.3 L  N # 3@@@@@@@K@@@@@@@@@8%clearP 5 9P 5 >@б@г⠐!tP 5 DP 5 E@А!a@C@3@Wr>@AP 5 AP 5 C@@@ @@@ @@гx$unitP 5 IP 5 M@@ @@@@@@@@@@@P 5 5 @ $ Discard all elements from a queue. Q N NQ N w@@@@@@@L@@@@@@@@@8$copyS y }S y @б@г8!tS y S y @А!a@C@3        @Wr>@AS y S y @@@ @@@ @@гT!t!S y "S y @А!a(S y )S y @@@"@@@ @@@@@!@@@4S y y@S # Return a copy of the given queue. AT  BT  @@@@@@@ZM@@#@cU@@@@@@@(is_empty XV  YV  @б@г!tcV  dV  @А!a@C@3kjjkkkkk@_z>@AqV  rV  @@@ @@@ @@г=$boolV  V  @@ @@@@@@@@@@@V   @ ? Return [true] if the given queue is empty, [false] otherwise. W  W  @@@@@@@N@@@@@@@@@8&length!Y  !Y  '@б@г점!tY  -Y  .@А!a@C@3@Wr>@AY  *Y  ,@@@ @@@ @@г#intY  2Y  5@@ @@@@@@@@@@@Y   @ + Return the number of elements in a queue. Z 6 6Z 6 f@@@@@@@O@@@@@@@@@8$iter"\ h l\ h p@б@б@А!a@C@3@Oj6@A\ h t\ h v@@гˠ$unit\ h z\ h ~@@ @@@@@@@@ @@б@гc!t0\ h 1\ h @А!a)$7\ h 8\ h @@@/@@@ + @@г$unitE\ h F\ h @@ @@@ 8@@@@@ ;@@@,@@>Q\ h s @@@T\ h h@s [iter f q] applies [f] in turn to all elements of [q], from the least recently entered to the most recently entered. The queue itself is unchanged. a]  b_  0@@@@@@@zP@@@u@@@@@@^$fold#xa 2 6ya 2 :@б@б@А#acc@C@3@u6@Aa 2 >a 2 B@@б@А!a@C@a 2 Fa 2 H@@А#acca 2 La 2 P@@@@@ @@@"@@@@б@А#acc(#a 2 Ua 2 Y@@б@г蠐!ta 2 `a 2 a@А!a+5a 2 ]a 2 _@@@1@@@< @@А#accE@a 2 ea 2 i@@@ J@@E@@@M@@H%@@@0@@Ka 2 = @@@a 2 2@ [fold f accu q] is equivalent to [List.fold_left f accu l], where [l] is the list of [q]'s elements. The queue remains unchanged. b j jd  @@@@@@@Q@@@@@@@@@k(transfer$f  f @б@г7!tf  f  @А!a@'C@3        @>@Af  f  @@@ @@@  @@б@гU!t"f #f @А!a)f *f @@@$@@@"  @@г䠐$unit7f 8f @@ @@@#-@@@@@$0@@@.@@%31 @@@Ef  @d [transfer q1 q2] adds all of [q1]'s elements at the end of the queue [q2], then clears [q1]. It is equivalent to the sequence [iter (fun x -> add x q2) q1; clear q1], but runs in constant time. RgSj@@@@@@@kR@@@tf@@@@@@Rts/ {1 Iterators} plql@@@@@@3onnooooo@d1@A&to_seqd|n }n@б@г!tnn@А!a@ RC@( nn@@@ @@@*'@@г*#Seq!tnn"@ n#n$@@А!a#>nn@@@)@@@ OE@@@%@@ PH(@@@n@ܐ Iterate on the queue, in front-to-back order. The behavior is not specified if the queue is modified during the iteration. @since 4.07 o%%r@@@@@@@S@@$@ސ@@@@@@g'add_seqett@б@г!ttt@А!a@ \C@ S3@>@Att@@@ @@@ U @@б@г#Seq!t t t@  t t@@А!a'" t t@@@-@@@ W)@@гՠ$unit (t )t@@ @@@ X6@@@@@ Y9@@@7@@ Z<: @@@ 6t@U K Add the elements from a sequence to the end of the queue. @since 4.07  Cu Dv%7@@@@@@@ \T@@@e W@@@@@@[&of_seqf Zx9= [x9C@б@г#Seq!t ix9I jx9L@  mx9M nx9N@@А!a@ dC@ ]3 v u u v v v v v@G@A |x9F }x9H@@@  @@@ _ @@г!t x9U x9V@А!a x9R x9T@@@"@@@ a @@@@@ b!@@@ x99@ 1 Create a queue from a sequence. @since 4.07  yWW z{@@@@@@@ U@@#@ @@@@@@@  ː  {1:examples Examples} {2 Basic Example} A basic example: {[ # let q = Queue.create () val q : '_weak1 Queue.t = # Queue.push 1 q; Queue.push 2 q; Queue.push 3 q - : unit = () # Queue.length q - : int = 3 # Queue.pop q - : int = 1 # Queue.pop q - : int = 2 # Queue.pop q - : int = 3 # Queue.pop q Exception: Stdlib.Queue.Empty. ]} {2 Search Through a Graph} For a more elaborate example, a classic algorithmic use of queues is to implement a BFS (breadth-first search) through a graph. {[ type graph = { edges: (int, int list) Hashtbl.t } (* Search in graph [g] using BFS, starting from node [start]. It returns the first node that satisfies [p], or [None] if no node reachable from [start] satisfies [p]. *) let search_for ~(g:graph) ~(start:int) (p:int -> bool) : int option = let to_explore = Queue.create() in let explored = Hashtbl.create 16 in Queue.push start to_explore; let rec loop () = if Queue.is_empty to_explore then None else (* node to explore *) let node = Queue.pop to_explore in explore_node node and explore_node node = if not (Hashtbl.mem explored node) then ( if p node then Some node (* found *) else ( Hashtbl.add explored node (); let children = Hashtbl.find_opt g.edges node |> Option.value ~default:[] in List.iter (fun child -> Queue.push child to_explore) children; loop() ) ) else loop() in loop() (* a sample graph *) let my_graph: graph = let edges = List.to_seq [ 1, [2;3]; 2, [10; 11]; 3, [4;5]; 5, [100]; 11, [0; 20]; ] |> Hashtbl.of_seq in {edges} # search_for ~g:my_graph ~start:1 (fun x -> x = 30) - : int option = None # search_for ~g:my_graph ~start:1 (fun x -> x >= 15) - : int option = Some 20 # search_for ~g:my_graph ~start:1 (fun x -> x >= 50) - : int option = Some 100 ]}  | 5:@@@@@@3        @Rv1@A@A@B@d@D@@Y@9@@c@C@@f@F@@b@B@@|@@|9@@]@@3        @.@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  !G "G@ H en Automatique.  'H (Hg@ H  -Ihh .Ih@ H All rights reserved. This file is distributed under the terms of  3J 4J@ H the GNU Lesser General Public License version 2.1, with the  9K :KN@ H special exception on linking described in the file LICENSE.  ?LOO @LO@ H  EM FM@ H************************************************************************ KN LN5@ * First-in first-out queues. This module implements queues (FIFOs), with in-place modification. See {{!examples} the example section} below.  Q>* {b Unsynchronized accesses} Π * Unsynchronized accesses to a queue may lead to an invalid queue state. Thus, concurrent accesses to queues must be synchronized (for instance with a {!Mutex.t}).  7* The type of queues containing elements of type ['a]. j K* Raised when {!Queue.take} or {!Queue.peek} is applied to an empty queue. : '* Return a new queue, initially empty. 㠠 >* [add x q] adds the element [x] at the end of the queue [q].  !* [push] is a synonym for [add]. ' l* [take q] removes and returns the first element in queue [q], or raises {!Empty} if the queue is empty. ۠ ~* [take_opt q] removes and returns the first element in queue [q], or returns [None] if the queue is empty. @since 4.08  !* [pop] is a synonym for [take]. 4 * [peek q] returns the first element in queue [q], without removing it from the queue, or raises {!Empty} if the queue is empty. 蠠 * [peek_opt q] returns the first element in queue [q], without removing it from the queue, or returns [None] if the queue is empty. @since 4.08  !* [top] is a synonym for [peek]. A n* [drop q] removes the first element in queue [q], or raises {!Empty} if the queue is empty. @since 5.3  %* Discard all elements from a queue.  $* Return a copy of the given queue. @ @* Return [true] if the given queue is empty, [false] otherwise.  ,* Return the number of elements in a queue.  * [iter f q] applies [f] in turn to all elements of [q], from the least recently entered to the most recently entered. The queue itself is unchanged. ) * [fold f accu q] is equivalent to [List.fold_left f accu l], where [l] is the list of [q]'s elements. The queue remains unchanged.  * [transfer q1 q2] adds all of [q1]'s elements at the end of the queue [q2], then clears [q1]. It is equivalent to the sequence [iter (fun x -> add x q2) q1; clear q1], but runs in constant time. >0* {1 Iterators} # * Iterate on the queue, in front-to-back order. The behavior is not specified if the queue is modified during the iteration. @since 4.07 ̠ L* Add the elements from a sequence to the end of the queue. @since 4.07 V 2* Create a queue from a sequence. @since 4.07  * {1:examples Examples} {2 Basic Example} A basic example: {[ # let q = Queue.create () val q : '_weak1 Queue.t = # Queue.push 1 q; Queue.push 2 q; Queue.push 3 q - : unit = () # Queue.length q - : int = 3 # Queue.pop q - : int = 1 # Queue.pop q - : int = 2 # Queue.pop q - : int = 3 # Queue.pop q Exception: Stdlib.Queue.Empty. ]} {2 Search Through a Graph} For a more elaborate example, a classic algorithmic use of queues is to implement a BFS (breadth-first search) through a graph. {[ type graph = { edges: (int, int list) Hashtbl.t } (* Search in graph [g] using BFS, starting from node [start]. It returns the first node that satisfies [p], or [None] if no node reachable from [start] satisfies [p]. *) let search_for ~(g:graph) ~(start:int) (p:int -> bool) : int option = let to_explore = Queue.create() in let explored = Hashtbl.create 16 in Queue.push start to_explore; let rec loop () = if Queue.is_empty to_explore then None else (* node to explore *) let node = Queue.pop to_explore in explore_node node and explore_node node = if not (Hashtbl.mem explored node) then ( if p node then Some node (* found *) else ( Hashtbl.add explored node (); let children = Hashtbl.find_opt g.edges node |> Option.value ~default:[] in List.iter (fun child -> Queue.push child to_explore) children; loop() ) ) else loop() in loop() (* a sample graph *) let my_graph: graph = let edges = List.to_seq [ 1, [2;3]; 2, [10; 11]; 3, [4;5]; 5, [100]; 11, [0; 20]; ] |> Hashtbl.of_seq in {edges} # search_for ~g:my_graph ~start:1 (fun x -> x = 30) - : int option = None # search_for ~g:my_graph ~start:1 (fun x -> x >= 15) - : int option = Some 20 # search_for ~g:my_graph ~start:1 (fun x -> x >= 50) - : int option = Some 100 ]} @?)../ocamlc0-strict-sequence(-absname"-w5+a-4-9-41-42-44-45-48"-g+-warn-error"+A*-bin-annot)-nostdlib*-principal"-o1stdlib__Queue.cmi"-c  D/builds/workspace/precheck/flambda/false/label/ocaml-linux-32/stdlib @@0Jvo8yWuU3        @ @@8CamlinternalFormatBasics0%FU(Q/Tu&Stdlib0Lku]8_٠.Stdlib__Either0Vy`u~c à ܐ0/~7[YH+Stdlib__Seq0nwzG&amg@0/~7[YHAVC@@d0AR@GT@H !@@]@`@Qs@@(~@@@Ք@@P@@P@@