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] /4/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;@@#intA@@@@@;@A@$charB;@@$charA@@@@@A@A@&stringQ;@@&stringA@@@@@G@@@%bytesC;@@%bytesA@@@@@M@@@%floatD;@@%floatA@@@@@S@@@$boolE;@@%falsec@@]@$trued@@c@@@A@@@@@d@A@$unitF;@@"()e@@n@@@A@@@@@o@A@ #exnG;@@@A@@@@@s@@@#effH;@@O@A@A@@@@@@|@@@,continuationI;@@Q@@P@B,continuationA@nY@@@@@@@@@%arrayJ;@@R@A%arrayA@@@@@@@@@ $listK;@@S@A"[]f@@@"::g@@@T@@@ @@A@Y@@@@@@@@&optionL;@@V@A$Noneh@@@$Somei@@@@@A@Y@@@@@@@@)nativeintM;@@)nativeintA@@@@@@@@%int32N;@@%int32A@@@@@@@@%int64O;@@%int64A@@@@@@@@&lazy_tP;@@X@A&lazy_tA@Y@@@@@@@@ 5extension_constructorR;@@5extension_constructorA@@@@@@@@*floatarrayS;@@*floatarrayA@@@@@@@@&iarrayT;@@Y@A&iarrayA@Y@@@@@@@@ *atomic_locU;@@Z@A*atomic_locA@@@@@@ @@@ .Assert_failure`#@@@@@J@@@@@@@@[@@A!=ocaml.warn_on_literal_pattern%@&@0Division_by_zero]#@@@A+ . .@+End_of_file\#$@@@A366@'FailureY#,@'@@A<??@0Invalid_argumentX#5@0@@AE$H#H@-Match_failureV#>@@=@9@;@@a@@AV5Y4Y@)Not_foundZ#O@@@A^=a<a@-Out_of_memoryW#W@@@AfEiDi@.Stack_overflow^#_@@@AnMqLq@.Sys_blocked_io_#g@@@AvUyTy@)Sys_error[#o@j@@A^]@:Undefined_recursive_modulea#x@@w@s@u@@h@@Aon@:Continuation_already_takenb#@@@Awv@&Stdlib@A= {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].  c cU@@@@@@@@@$@@@Abb@@B@@;%@A@A@O@B@@@@@ @@A@'@@@@@@@':@%EmptyB,fXb-fXg@#.@@@A1fXX@5 J Raised when {!Queue.take} or {!Queue.peek} is applied to an empty queue. >ghh?gh@@@@@@@WA@@@@FS@@@@@@@3KJJKKKKK@Jl>@A $@&createYjZj@б@г$unitdjej@@ @@@3feefffff@C=@A@@г!tsjtj@А!a@C@jj@@@ @@@@@@"@@%@@@j@ & Return a new queue, initially empty. kk@@@@@@@B@@(@@@@@@@>#addmm@б@А!a@C@3@Sh4@Am m @@б@г᠐!tmm@А!amm@@@@@@ @@г$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@Apbm pbo@@б@гB!t*pbv+pbw@А!a1pbs2pbu@@@@@@ @@г㠐$unit?pb{@pb@@ @@@(@@@@@+@@@3@@., @@@Mpbb@Q [push] is a synonym for [add]. Zq[q@@@@@@@sD@@@an@@@@@@M$takeqsrs@б@г!t|s}s@А!a@C@3@l}>@Ass@@@ @@@ @@А!a ss@@@ @@@@@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@310011111@_z>@A7|8|@@@ @@@ @@А!a B|C|@@@ @@@@@I|@M [pop] is a synonym for [take]. V}W} @@@@@@@oG@@@]j@@@@@@1$peekm  n  @б@г!tx  y  @А!a@C@3@Pk>@A    @@@ @@@ @@А!a   #  %@@@ @@@@@  @ [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  @@@ @@@ @@г7&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>@A3H m w4H m y@@@ @@@ @@А!a >H m ?H m @@@ @@@@@EH m m@I [top] is a synonym for [peek]. RI  SI  @@@@@@@kJ@@@Yf@@@@@@1$dropiK  jK  @б@г!ttK  uK  @А!a@C@3|{{|||||@Pk>@AK  K  @@@ @@@ @@г4$unitK  K  @@ @@@@@@@@@@@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@@@ @@@ @@г$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!t S y !S y @А!a@C@3(''(((((@Wr>@A.S y /S y @@@ @@@ @@гT!t<S y =S y @А!aCS y DS y @@@"@@@ @@@@@!@@@OS y y@S # Return a copy of the given queue. \T  ]T  @@@@@@@uM@@#@cp@@@@@@@(is_empty sV  tV  @б@г!t~V  V  @А!a@C@3@_z>@AV  V  @@@ @@@ @@гO$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 6 Z 6 f@@@@@@@!O@@@@@@@@@8$iter"\ h l \ h p@б@б@А!a@C@3*))*****@Oj6@A0\ h t1\ h v@@гݠ$unit9\ h z:\ h ~@@ @@@@@@@@ @@б@гc!tK\ h L\ h @А!a)$R\ h S\ h @@@/@@@ + @@г$unit`\ h a\ h @@ @@@ 8@@@@@ ;@@@,@@>l\ h s @@@o\ 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. |]  }_  0@@@@@@@P@@@@@@@@@^$fold#a 2 6a 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'&&'''''@>@A-f  .f  @@@ @@@  @@б@гU!t=f >f @А!aDf Ef @@@$@@@"  @@г$unitRf Sf @@ @@@#-@@@@@$0@@@.@@%31 @@@`f  @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. mgnj@@@@@@@R@@@t@@@@@@R/ {1 Iterators} ll@@@@@@3@d1@A&to_seqdn 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@б@г!t t t@А!a@ \C@ S3        @>@A t t@@@ @@@ U @@б@г#Seq!t )t *t@  -t .t@@А!a'" 5t 6t@@@-@@@ W)@@г砐$unit Ct Dt@@ @@@ X6@@@@@ Y9@@@7@@ Z<: @@@ Qt@U K Add the elements from a sequence to the end of the queue. @since 4.07  ^u _v%7@@@@@@@ wT@@@e r@@@@@@[&of_seqf ux9= vx9C@б@г#Seq!t x9I x9L@  x9M x9N@@А!a@ dC@ ]3        @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  0E44 1E4@ H  6F 7F@ H Copyright 1996 Institut National de Recherche en Informatique et  * {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 ǐ [/home/teraram/ci/builds/workspace/parallel-build/flambda/false/label/ocaml-manycores/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@@