Caml1999I037(=#L+Stdlib__Seq!tw;!a@D@A@A@$unitF@@@C$nodex@@@E@@FY@@@@@'seq.mliZZ@@@@#@@A@ ;!a@H@A#Nil@@b46b4;@@5B@$Cons<@@@G@@#c<>$c<Q@@EC@@@A@Y@@@@@)a%%@@@@JA@B@(is_emptyy@!a@I@@@J$boolE@@@K@@L@ACCBC^@@cD@@&unconsz@.!a@O@@@M&optionL@@B@@@N@@P@@@Q@@R@ef@@E@@&length{@R!a@S@@@T#intA@@@U@@V@~@@F@@$iter|@@!a@Y@@@W@@X@w @@@Z@@@[@@\@@]@###J@@G@@)fold_left}@@#acc@b@!a@` @@^@@_@ @ @@@a@@c@@d@@e@6@@H@@%iteri~@@Q@@@f@!a@j@@@g@@h@@i@ @@@k@@@l@@m@@n@666e@@I@@*fold_lefti@@#acc@u@|@@@o@!a@s@@p@@q@@r@@ @@@t@@v@@w@@x@ } } } @@(J@@'for_all@@!a@{@@@y@@z@ @@@|@@@}@@~@@@%"G"G&"G"q@@GK@@&exists@@!a@@@@@@@ @@@@@@@@@@@D##E##;@@fL@@$find@@!a@@@@@@@= @@@ @@@@@@@@d##e#$@@M@@*find_index@@!a@:@@@@@@] @@@+ @@@@@@@@@@@%%%%G@@N@@(find_map@@!a@E!b@@@@@@@@@@T@@@@@@@@&`&`&`&@@O@@)find_mapi@@B@@@@!a@p!b@@@@@@@@@@@@@@@@@@@@'''( @@P@@%iter2@@!a@@!b@@@@@@@@@נ@@@@ݠ@@@@@@@@@@@@@((())@@%Q@@*fold_left2@@#acc@@!a@@!b@@@@@@@@@@@@@ @@@@@@@@@@@@.+5+5/+5+@@PR@@(for_all2@@!a@@!b@ @@@@@@@@-@@@@3@@@@@@@@@@@@@Y!--Z!-.2@@{S@@'exists2@@!a@@!b@5@@@@@@@@X@@@@^@@@E@@@@@@@@@@3003015@@T@@%equal@@!a@@!b@`@@@@@@@@@@@@@@@p@@@@@@@@@@A3333A333i@@U@@'compare@@!a@@!b@N@@@@@@@@@@@@@@@^@@@@@@@@@@J4h4hJ4h4@@V@@%emptyŠ!a@@@@@Z66Z66@@ W@@&return@!a@ܠ@@@@@@^66^67 @@ X@@$cons@!a@@ @@@ @@@@@@@@b7^7^b7^7{@@9Y@@)singleton@!a@@@@@@@*m88+m88@@LZ@@$init@@@@@@@@@!a@@@'@@@@@@@@Ir9@9@Jr9@9e@@k[@@&unfold@@!b@@!a@@@@@@@@@@M @@@@@@@@o~:b:bp~:b:@@\@@&repeat@!a@`@@@@@ @<<<<2@@]@@'forever@@@@@ !a@ @@ y@@@ @@@<<<<@@^@@%cycle@!a@@@@@@@@@@>>>>)@@_@@'iterate@@!a@@@@ @@@@@@@@????@@`@@#map@@!a@!b@@@@  @@@Ơ @@@@@@@@A3A3A3AW@@ a@@$mapi@@}@@@@!a@"!b@$@@ @@!@ @@@# @@@%@@&@@'@ BBBB?@@/b@@&filter@@!a@+@@@(@@)@ @@@* @@@,@@-@@.@,BB-BC@@Nc@@'filteri@@@@@/@!a@4@@@0@@1@@2@+ @@@3/@@@5@@6@@7@QCCRCD@@sd@@*filter_map@@!a@:!b@<@@@8@@9@O@@@;S@@@=@@>@@?@uDDvDE@@e@@$scan@@!b@D@!a@B @@@@@A@ @r @@@Cv@@@E@@F@@G@@H@EEEF @@f@@$take@+@@@I@!a@K@@@J@@@L@@M@@N@HmHmHmH@@g@@$drop@H@@@O@!a@Q@@@P@@@R@@S@@T@IIII@@h@@*take_while@@!a@X@@@U@@V@ˠ @@@WϠ@@@Y@@Z@@[@K/K/K/K\@@i@@*drop_while@@!a@_@@@\@@]@ @@@^@@@`@@a@@b@KKKL @@2j@@%group@@!a@g@@@@c@@d@@e@ @@@f@@@h@@@i@@j@@k@5L}L}6L}L@@Wk@@'memoize@"!a@m@@@l*@@@n@@o@L)NNM)NN@@nl@@ ,Forced_twice##exnG@@@A&_none_@@A@{m@B@$once@F!a@q@@@pN@@@r@@s@p=QmQmq=QmQ@@n@@)transpose@]`!a@v@@@t@@@uil @@@w@@@x@@y@KSSKSS@@o@@&append@|!a@|@@@z@ @@@{@@@}@@~@@@YU)U)YU)UJ@@p@@&concat@!a@@@@@@@ @@@@@@`UU`UV@@q@@(flat_map@@!a@!b@@@@@@@Ġ@@@Ƞ@@@@@@@@iVViVW@@ r@@*concat_map@@!a@ݠ!b@@@@@@@@@@@@@@@@@@ lWMWMlWMWz@@/s@@#zip@!a@@@@@!b@@@@ @@@@@@@@@@@@4sWW5sWX@@Vt@@$map2@@!a@@!b@!c@@@@@@3@@@@9@@@=@@@@@@@@@@_YY`YY@@u@@*interleave@L!a@@@@@V @@@Z@@@@@@@@|[[}[[@@v@@,sorted_merge@@!a@@@@@@@@@@w@@@@}@@@@@@@@@@@@@\\\]@@w@@'product@!a@@@@@!b@@@@@@@@@@@@@@@@^"^"^"^K@@x@@+map_product@@!a@@!b@!c@@@@@@ɠ@@@@Ϡ@@@Ӡ@@@@@@@@@@___`!@@y@@%unzip@@!a@Ϡ@!b@@@@@@@@@@Р@@@@@@@@@ bb!bb@@Bz@@%split@ @!a@נ@!b@@@@@@@#@@@ؠ@)@@@@@@@@KdSdSLdSdy@@m{@@-partition_map@@!a@&Stdlib&Either!t!b@!c@@@@@@@T@@@@\@@@⠠@b@@@@@@@@@@dddd@@|@@)partition@@!a@Z@@@@@@} @@@@@@@렠@@@@@@@@@@@gggh@@}@@,of_dispenser@@@@@j!a@@@@@@@@@@@@l;l;l;li@@~@@,to_dispenser@!a@@@@@@@@@@@@@@@@ mdmd mdm@@ @@$ints@|@@@ڠ@@@@@@@@@nnnn@@"@@@@L=+Stdlib__Seq0nwzG&amg.Stdlib__Either0Vy`u~c à&Stdlib0Lku]8_٠8CamlinternalFormatBasics0%FU(Q/Tu@@@Caml1999T037u,#FQC+Stdlib__Seq*ocaml.text&_none_@@A u Sequences. A sequence of type ['a Seq.t] can be thought of as a {b delayed list}, that is, a list whose elements are computed only when they are demanded by a consumer. This allows sequences to be produced and transformed lazily (one element at a time) rather than eagerly (all elements at once). This also allows constructing conceptually infinite sequences. The type ['a Seq.t] is defined as a synonym for [unit -> 'a Seq.node]. This is a function type: therefore, it is opaque. The consumer can {b query} a sequence in order to request the next element (if there is one), but cannot otherwise inspect the sequence in any way. Because it is opaque, the type ['a Seq.t] does {i not} reveal whether a sequence is: - {b persistent}, which means that the sequence can be used as many times as desired, producing the same elements every time, just like an immutable list; or - {b ephemeral}, which means that the sequence is not persistent. Querying an ephemeral sequence might have an observable side effect, such as incrementing a mutable counter. As a common special case, an ephemeral sequence can be {b affine}, which means that it must be queried at most once. It also does {i not} reveal whether the elements of the sequence are: - {b pre-computed and stored} in memory, which means that querying the sequence is cheap; - {b computed when first demanded and then stored} in memory, which means that querying the sequence once can be expensive, but querying the same sequence again is cheap; or - {b re-computed every time they are demanded}, which may or may not be cheap. It is up to the programmer to keep these distinctions in mind so as to understand the time and space requirements of sequences. For the sake of simplicity, most of the documentation that follows is written under the implicit assumption that the sequences at hand are persistent. We normally do not point out {i when} or {i how many times} each function is invoked, because that would be too verbose. For instance, in the description of [map], we write: "if [xs] is the sequence [x0; x1; ...] then [map f xs] is the sequence [f x0; f x1; ...]". If we wished to be more explicit, we could point out that the transformation takes place on demand: that is, the elements of [map f xs] are computed only when they are demanded. In other words, the definition [let ys = map f xs] terminates immediately and does not invoke [f]. The function call [f x0] takes place only when the first element of [ys] is demanded, via the function call [ys()]. Furthermore, calling [ys()] twice causes [f x0] to be called twice as well. If one wishes for [f] to be applied at most once to each element of [xs], even in scenarios where [ys] is queried more than once, then one should use [let ys = memoize (map f xs)]. As a general rule, the functions that build sequences, such as [map], [filter], [scan], [take], etc., produce sequences whose elements are computed only on demand. The functions that eagerly consume sequences, such as [is_empty], [find], [length], [iter], [fold_left], etc., are the functions that force computation to take place. When possible, we recommend using sequences rather than dispensers (functions of type [unit -> 'a option] that produce elements upon demand). Whereas sequences can be persistent or ephemeral, dispensers are always ephemeral, and are typically more difficult to work with than sequences. Two conversion functions, {!to_dispenser} and {!of_dispenser}, are provided. @since 4.07 'seq.mliP77X@@@@@@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@AxA+!tAZZ@А!a@3@;@@@A@A@@@@@@G@B@@@ZZ@)ocaml.doc O A sequence [xs] of type ['a t] is a delayed list of elements of type ['a]. Such a sequence is queried by performing a function application [xs()]. This function application returns a node, allowing the caller to determine whether the sequence is empty or nonempty, and in the latter case, to obtain its head and tail. [_#@@@@@@@@@@@$nodeA;@@@A@A@G@B@@@a%%c<Q@ A node is either [Nil], which means that the sequence is empty, or [Cons (x, xs)], which means that [x] is the first element of the sequence and that [xs] is the remainder of the sequence. dWWf"@@@@@@@@@A@@AZZ@@BA@;L@A@A@@@@,ZB@@@@@@Y@@@@@FC@@3@@Aб@г$unitZZ@@e@@г$nodeZW@А!aqZZ@@@#t_@@*u`@@b_^]@]]@@@]@]@+[[a%-a%1@А!a@a%*a%,@@@A@; @A#Nil@@&b46'b4;@@?B@$ConsB@"B@@@@@@:c<>~@@RC@@@A@Y@@@@@@@r@#Cb48@@@@ @#Ic<@Jc<D@@А!a!ưQc<HRc<J@@г"!tZc<P@А!a)հ`c<Mac<O@@@0ذ@@@@*@@A@s@@@@@@@k@9 {1 Consuming sequences} ~h$$h$B@@@@@@3}||}}}}}@}f@A  The functions in this section consume their argument, a sequence, either partially or completely: - [is_empty] and [uncons] consume the sequence down to depth 1. That is, they demand the first argument of the sequence, if there is one. - [iter], [fold_left], [length], etc., consume the sequence all the way to its end. They terminate only if the sequence is finite. - [for_all], [exists], [find], etc. consume the sequence down to a certain depth, which is a priori unpredictable. Similarly, among the functions that consume two sequences, one can distinguish two groups: - [iter2] and [fold_left2] consume both sequences all the way to the end, provided the sequences have the same length. - [for_all2], [exists2], [equal], [compare] consume the sequences down to a certain depth, which is a priori unpredictable. The functions that consume two sequences can be applied to two sequences of distinct lengths: in that case, the excess elements in the longer sequence are ignored. (It may be the case that one excess element is demanded, even though this element is not used.) None of the functions in this section is lazy. These functions are consumers: they force some computation to take place. jDDA@@@@@@(is_emptyCGCO@б@г'!tCUCV@А!a@B@2CRCT@@@ @@@9@@г$boolCZC^@@ @@@F@@@@@I@@@CC @, E [is_empty xs] determines whether the sequence [xs] is empty. It is recommended that the sequence [xs] be persistent. Indeed, [is_empty xs] demands the head of the sequence [xs], so, if [xs] is ephemeral, it may be the case that [xs] cannot be used any more after this call has taken place. @since 4.14 __@@@@@@@D@@@<퐠@@@@@@h&uncons@б@г{!t@А!a@B@3@p>@A  @@@ @@@ @@гv&option@В@А!a "#@@@г!t-.@А!a2-45@@@8@@@4 @@@@>@ @@; @@@2 @@@@G0@@@?@@DB3@@@M6@ If [xs] is empty, then [uncons xs] is [None]. If [xs] is nonempty, then [uncons xs] is [Some (x, ys)] where [x] is the head of the sequence and [ys] its tail. @since 4.14 Z[@@@@@@@sE@@F@n@@@@@@c&lengthqr@б@г!t|}@А!a@B@3@>@A@@@ @@@ @@гk#int@@ @@@@@@@@@@@ @ o [length xs] is the length of the sequence [xs]. Does not terminate if [xs] is infinite. @since 4.14 !@@@@@@@F@@@Đ@@@@@@8$iter#'#+@б@б@А!a@B@3@Oj6@A#/#1@@г$unit#5#9@@ @@@@@@@@@@б@гs!t#A#B@А!a)$#>#@@@@/@@@+ @@г$unit#F #J@@ @@@8@@@@@;@@@,@@>#. @@@##@w [iter f xs] invokes [f x] successively for every element [x] of the sequence [xs], from left to right. It terminates only if the sequence [xs] is finite. $KK%@@@@@@@=G@@@8@@@@@@^)fold_left;<@б@б@А#acc@B@3FEEFFFFF@u6@AL M@@б@А!a@ B@YZ@@А#acc_`@@@@@ @@@"@@@@б@А#acc(#m"n&@@б@г!tx-y.@А!a+5*,@@@1@@@< @@А#accE@26@@@ J@@ E@@@M@@ H%@@@0@@ K  @@@@ [fold_left f _ xs] invokes [f _ x] successively for every element [x] of the sequence [xs], from left to right. An accumulator of type ['a] is threaded through the calls to [f]. It terminates only if the sequence [xs] is finite. 774@@@@@@@H@@@@@@@@@k%iteri6:6?@б@б@г#int6C6F@@ @@@3@:@A@@б@А!a@B@ 6J6L@@г$unit6P6T@@ @@@@@@@@@@@%@@"( @@б@гz!t6\6]@А!a*26Y6[@@@0@@@9 @@г$unit6a6e@@ @@@F@@@@@I@@@,@@L6B @@@66@~  [iteri f xs] invokes [f i x] successively for every element [x] located at index [i] in the sequence [xs]. It terminates only if the sequence [xs] is finite. [iteri f xs] is equivalent to [iter (fun (i, x) -> f i x) (zip (ints 0) xs)]. @since 4.14 +ff, i {@@@@@@@DI@@@?@@@@@@l*fold_leftiB } C } @б@б@А#acc@*B@3MLLMMMMM@6@AS } T } @@б@г1#int^ } _ } @@ @@@@@б@А!a@(B@o } p } @@А#acc)$u } v } @@@.@@) @@@@@ ,@@@4@@!/- @@б@А#acc:5 }  } @@б@г!t }  } @А!a.G }  } @@@4@@@#N @@А#accWR }  } @@@ \@@$W@@@_@@%Z%@@@0@@&] }  @@@ } }@ ~ [fold_lefti f _ xs] invokes [f _ i x] successively for every element [x] located at index [i] of the sequence [xs]. An accumulator of type ['b] is threaded through the calls to [f]. It terminates only if the sequence [xs] is finite. [fold_lefti f accu xs] is equivalent to [fold_left (fun accu (i, x) -> f accu i x) accu (zip (ints 0) xs)]. @since 4.14   "3"E@@@@@@@J@@@!Ґ@@@@@@}'for_all"G"K"G"R@б@б@А!a@4B@+3@6@A"G"V"G"X@@г$bool"G"\"G"`@@ @@@,@@@@@-@@б@г!t"G"h"G"i@А!a)$"G"e "G"g@@@/@@@/+ @@гԠ$bool"G"m"G"q@@ @@@08@@@@@1;@@@,@@2>""G"U @@@%"G"G@ [for_all p xs] determines whether all elements [x] of the sequence [xs] satisfy [p x]. May not terminate if [xs] is infinite. @since 4.14 2"r"r3"#@@@@@@@KK@@@F@@@@@@^&existsI##J##@б@б@А!a@>B@53TSSTTTTT@u6@AZ## [##"@@г!$boolc##&d##*@@ @@@6@@@@@7@@б@г!tu##2v##3@А!a)$|##/}##1@@@/@@@9+ @@гH$bool##7##;@@ @@@:8@@@@@;;@@@,@@<>## @@@##@ [exists p xs] determines whether at least one element [x] of the sequence [xs] satisfies [p x]. May not terminate if [xs] is infinite. @since 4.14 #<#<##@@@@@@@L@@@ @@@@@@^$find####@б@б@А!a@IB@?3@u6@A####@@г$bool####@@ @@@@@@@@@A@@б@гi!t#$#$@А!a)$#$#$@@@/@@@C+ @@г]&option#$ #$@А!a>9#$#$ @@@D@@@E@ @@@@@FC@@@4@@GF##@@@##@u [find p xs] returns [Some x], where [x] is the first element of the sequence [xs] that satisfies [p x], if there is such an element. It returns [None] if there is no such element. May not terminate if [xs] is infinite. @since 4.14 "$$#%%@@@@@@@;M@@'@6@@@@@@f*find_index 9%%:%%"@б@б@А!a@UB@J3DCCDDDDD@}6@AJ%%&K%%(@@г$boolS%%,T%%0@@ @@@K@@@@@L@@б@г堐!te%%8f%%9@А!a)$l%%5m%%7@@@/@@@N+ @@г٠&optionz%%A{%%G@гW#int%%=%%@@@ @@@OB@@@@@@QG @@@#@@RJ&@@@;@@SM%%%@@@%%@  [find_index p xs] returns [Some i], where [i] is the index of the first element of the sequence [xs] that satisfies [p x], if there is such an element. It returns [None] if there is no such element. May not terminate if [xs] is infinite. @since 5.1 %H%H&M&^@@@@@@@N@@.@@@@@@@m(find_map!&`&d&`&l@б@б@А!a@bB@V3@6@A&`&p&`&r@@г5&option&`&y&`&@А!b@dB@W&`&v&`&x@@@ @@@Y@@@&@@Z!@@б@гu!t&`&&`&@А!a61&`&&`&@@@<@@@\8 @@гi&option &`& &`&@А!b4F&`&&`&@@@:@@@^M @@@@@_P@@@4@@`S&`&o@@@!&`&`@ 3 [find_map f xs] returns [Some y], where [x] is the first element of the sequence [xs] such that [f x = Some _], if there is such an element, and where [y] is defined by [f x = Some y]. It returns [None] if there is no such element. May not terminate if [xs] is infinite. @since 4.14 .&&/''@@@@@@@GO@@'@B@@@@@@s)find_mapi"E''F''@б@б@г%#intR''S''@@ @@@e3TSSTTTTT@:@A@@б@А!a@sB@f e''f''@@г͠&optionn''o''@А!b@uB@g"z''{''@@@ @@@i)@@@$@@j,@@@2@@k/5@@б@г!t'''(@А!a7?''''@@@=@@@mF @@г&option'('( @А!b7T'('(@@@=@@@o[ @@@@@p^@@@4@@qa''@@@''@ Same as [find_map], but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument. May not terminate if [xs] is infinite. @since 5.1 ((((@@@@@@@P@@'@,ݐ@@@@@@%iter2#((((@б@б@А!a@B@v3@6@A()()@@б@А!b@B@w()()@@г$unit ()  ()@@ @@@x@@@@@y!@@@)@@z$" @@б@г!t () ()@А!a94 #() $()@@@?@@@|; @@б@г!t 3()  4()!@А!bAK :() ;()@@@G@@@~R @@г$unit H()% I())@@ @@@_@@@@@b@@@.@@e1 @@@F@@h W((@@@ Z((@  [iter2 f xs ys] invokes [f x y] successively for every pair [(x, y)] of elements drawn synchronously from the sequences [xs] and [ys]. If the sequences [xs] and [ys] have different lengths, then iteration stops as soon as one sequence is exhausted; the excess elements in the other sequence are ignored. Iteration terminates only if at least one of the sequences [xs] and [ys] is finite. [iter2 f xs ys] is equivalent to [iter (fun (x, y) -> f x y) (zip xs ys)]. @since 4.14  g)*)* h +!+3@@@@@@@ Q@@"@ {@@@@@@*fold_left2$ ~+5+9 +5+C@б@б@А#acc@B@3        @6@A +5+G +5+K@@б@А!a@B@ +5+O +5+Q@@б@А!b@B@ +5+U +5+W@@А#acc'" +5+[ +5+_@@@,@@' @@@ @@*@@@2@@-+ @@б@А#acc83 +5+d +5+h@@б@гK!t +5+o +5+p@А!a;E +5+l +5+n@@@A@@@L @@б@гb!t +5+w +5+x@А!bE\ +5+t +5+v@@@K@@@c @@А#acclg +5+| +5+@@@ q@@l@@@'@@o*@@@w@@r? @@@J@@u +5+F@@@ +5+5@e q [fold_left2 f _ xs ys] invokes [f _ x y] successively for every pair [(x, y)] of elements drawn synchronously from the sequences [xs] and [ys]. An accumulator of type ['a] is threaded through the calls to [f]. If the sequences [xs] and [ys] have different lengths, then iteration stops as soon as one sequence is exhausted; the excess elements in the other sequence are ignored. Iteration terminates only if at least one of the sequences [xs] and [ys] is finite. [fold_left2 f accu xs ys] is equivalent to [fold_left (fun accu (x, y) -> f accu x y) (zip xs ys)]. @since 4.14  ++ --@@@@@@@ +R@@!@u &@@@@@@(for_all2% )!-- *!-.@б@б@А!a@B@3 4 3 3 4 4 4 4 4@6@A :!-.  ;!-. @@б@А!b@B@ G!-. H!-.@@г $bool P!-. Q!-.@@ @@@@@@@@!@@@)@@$" @@б@г堐!t e!-.! f!-."@А!a94 l!-. m!-. @@@?@@@; @@б@г!t |!-.) }!-.*@А!bAK !-.& !-.(@@@G@@@R @@г O$bool !-.. !-.2@@ @@@_@@@@@b@@@.@@e1 @@@F@@h !-.@@@ !--@   [for_all2 p xs ys] determines whether all pairs [(x, y)] of elements drawn synchronously from the sequences [xs] and [ys] satisfy [p x y]. If the sequences [xs] and [ys] have different lengths, then iteration stops as soon as one sequence is exhausted; the excess elements in the other sequence are ignored. In particular, if [xs] or [ys] is empty, then [for_all2 p xs ys] is true. This is where [for_all2] and [equal] differ: [equal eq xs ys] can be true only if [xs] and [ys] have the same length. May not terminate if both of the sequences [xs] and [ys] are infinite. [for_all2 p xs ys] is equivalent to [for_all (fun b -> b) (map2 p xs ys)]. @since 4.14  ".3.3 100@@@@@@@ S@@"@  Đ@@@@@@'exists2& 301 301@б@б@А!a@B@3        @6@A 301  301@@б@А!b@B@ 301 301@@г $bool 301 301@@ @@@@@@@@!@@@)@@$" @@б@г !t 301$ 301%@А!a94 301! 301#@@@?@@@; @@б@г !t 301, 301-@А!bAK !301) "301+@@@G@@@R @@г $bool /3011 03015@@ @@@_@@@@@b@@@.@@e1 @@@F@@h >301 @@@ A300@  [exists2 p xs ys] determines whether some pair [(x, y)] of elements drawn synchronously from the sequences [xs] and [ys] satisfies [p x y]. If the sequences [xs] and [ys] have different lengths, then iteration must stop as soon as one sequence is exhausted; the excess elements in the other sequence are ignored. May not terminate if both of the sequences [xs] and [ys] are infinite. [exists2 p xs ys] is equivalent to [exists (fun b -> b) (map2 p xs ys)]. @since 4.14  N41616 O?331@@@@@@@ gT@@"@  b@@@@@@%equal' eA3337 fA333<@б@б@А!a@B@3 p o o p p p p p@6@A vA333@ wA333B@@б@А!b@B@ A333F A333H@@г J$bool A333L A333P@@ @@@@@@@@!@@@)@@$" @@б@г !!t A333X A333Y@А!a94 A333U A333W@@@?@@@; @@б@г 8!t A333` A333a@А!bAK A333] A333_@@@G@@@R @@г $bool A333e A333i@@ @@@_@@@@@b@@@.@@e1 @@@F@@h A333?@@@ A3333@ ? Provided the function [eq] defines an equality on elements, [equal eq xs ys] determines whether the sequences [xs] and [ys] are pointwise equal. May not terminate if both of the sequences [xs] and [ys] are infinite. @since 4.14  B3j3j H4T4f@@@@@@@ U@@"@ O @@@@@@'compare( J4h4l J4h4s@б@б@А!a@B@3        @6@A J4h4w J4h4y@@б@А!b@B@ !J4h4} "J4h4@@г #int *J4h4 +J4h4@@ @@@@@@@@!@@@)@@$" @@б@г !t ?J4h4 @J4h4@А!a94 FJ4h4 GJ4h4@@@?@@@; @@б@г ֠!t VJ4h4 WJ4h4@А!bAK ]J4h4 ^J4h4@@@G@@@R @@г >#int kJ4h4 lJ4h4@@ @@@_@@@@@b@@@.@@e1 @@@F@@h zJ4h4v@@@ }J4h4h@ ݐ F Provided the function [cmp] defines a preorder on elements, [compare cmp xs ys] compares the sequences [xs] and [ys] according to the lexicographic preorder. For more details on comparison functions, see {!Array.sort}. May not terminate if both of the sequences [xs] and [ys] are infinite. @since 4.14  K44 S55@@@@@@@ V@@"@  @@@@@@  < {1 Constructing sequences}  U55 U56 @@@@@@3        @1@A  | The functions in this section are lazy: that is, they return sequences whose elements are computed only when demanded.  W66 X6Z6@@@@@@%empty) Z66 Z66@г N!t Z66 Z66@А!a@B@/ Z66 Z66@@@ @@@6@@@ Z66@ C I [empty] is the empty sequence. It has no elements. Its length is 0.  [66 \66@@@@@@@ W@@%@ S @@@@@@U&return* ^66 ^66@б@А!a@B@3        @jT4@A ^67 ^67@@г !t ^67  ^67 @А!a &^67 '^67@@@@@@ @@@!@@@@@ 2^66@ L [return x] is the sequence whose sole element is [x]. Its length is 1.  ?_7 7  @`7E7\@@@@@@@ XX@@#@  S@@@@@@;$cons+ Vb7^7b Wb7^7f@б@А!a@B@3 _ ^ ^ _ _ _ _ _@Pa4@A eb7^7i fb7^7k@@б@г !t pb7^7r qb7^7s@А!a wb7^7o xb7^7q@@@@@@ @@г !t b7^7z b7^7{@А!a.) b7^7w b7^7y@@@4@@@0 @@@@@3@@@;@@64@@@ b7^7^@ G [cons x xs] is the sequence that begins with the element [x], followed with the sequence [xs]. Writing [cons (f()) xs] causes the function call [f()] to take place immediately. For this call to be delayed until the sequence is queried, one must instead write [(fun () -> Cons(f(), xs))]. @since 4.11  c7|7| k88@@@@@@@ Y@@&@  @@@@@@U)singleton, m88 m88@б@А!a@B@3        @j{4@A m88 m88@@г W!t m88 m88@А!a m88 m88@@@@@@ @@@!@@@@@ m88@ J U [singleton x] returns the one-element sequence containing only [x]. @since 5.4  n88 p9-9>@@@@@@@Z@@#@ Z @@@@@@;$init-r9@9Dr9@9H@б@г 점#intr9@9Kr9@9N@@ @@@3@Te8@A@@б@б@г #int,r9@9S-r9@9V@@ @@@@@А!a@B@;r9@9Z<r9@9\@@@ @@!@@г Ǡ!tGr9@9dHr9@9e@А!a/Nr9@9aOr9@9c@@@@@@6 @@@@@9Xr9@9R@@@@@@=C@@@^r9@9@@ [init n f] is the sequence [f 0; f 1; ...; f (n-1)]. [n] must be nonnegative. If desired, the infinite sequence [f 0; f 1; ...] can be defined as [map f (ints 0)]. @raise Invalid_argument if [n] is negative. @since 4.14 ks9f9fl|:N:`@@@@@@@[@@'@ @@@@@@\&unfold.~:b:f~:b:l@б@б@А!b@B@3@s6@A~:b:p~:b:r@@г &option~:b:~:b:@В@А!a@B@~:b:w~:b:y@@@А!b(#~:b:|~:b:~@@@@@1@@,@@@( @@@1~:b:v&@@@:@@53)@@б@А!b@;~:b:~:b:@@г U!t~:b:~:b:@А!a5K~:b:~:b:@@@;@@@ R @@@Z@@ U@@@%@@ X~:b:o@@@~:b:b@ L ~ [unfold] constructs a sequence out of a step function and an initial state. If [f u] is [None] then [unfold f u] is the empty sequence. If [f u] is [Some (x, u')] then [unfold f u] is the nonempty sequence [cons x (unfold f u')]. For example, [unfold (function [] -> None | h :: t -> Some (h, t)) l] is equivalent to [List.to_seq l]. @since 4.11 ::<<@@@@@@@\@@'@ \ @@@@@@x&repeat/<<<<%@б@А!a@B@3@4@A<<( <<*@@г !t(<<1)<<2@А!a/<<.0<<0@@@@@@ @@@!@@@@@;<<@ [repeat x] is the infinite sequence where the element [x] is repeated indefinitely. [repeat x] is equivalent to [cycle (return x)]. @since 4.14 H<3<3I<<@@@@@@@a]@@#@ \@@@@@@;'forever0_<<`<<@б@б@г$unitl<<m<<@@ @@@3nmmnnnnn@Vg:@A@@А!a@B@ }<<~<<@@@ @@@@г !t<<<<@А!a<<<<@@@@@@% @@@@@(<<@@@<<@  [forever f] is an infinite sequence where every element is produced (on demand) by the function call [f()]. For instance, [forever Random.bool] is an infinite sequence of random bits. [forever f] is equivalent to [map f (repeat ())]. @since 4.14 <<=>@@@@@@@^@@$@ @@@@@@H%cycle1>>>>@б@гL!t>> >>!@А!a@&B@3@g~>@A>>>>@@@ @@@! @@гh!t>>(>>)@А!a>>%>>'@@@"@@@# @@@@@$!@@@>>@[ m [cycle xs] is the infinite sequence that consists of an infinite number of repetitions of the sequence [xs]. If [xs] is an empty sequence, then [cycle xs] is empty as well. Consuming (a prefix of) the sequence [cycle xs] once can cause the sequence [xs] to be consumed more than once. Therefore, [xs] must be persistent. @since 4.14 >*>* ??@@@@@@@!_@@#@k@@@@@@@'iterate2?? ??@б@б@А!a@.B@'3*))*****@Wr6@A0??1??@@А!a 6??7??@@@@@(  @@б@А!aA??B??@@гʠ!tJ??K??@А!a(#Q??R??@@@.@@@** @@@2@@+-@@@%@@,0^??@@@a??@ [iterate f x] is the infinite sequence whose elements are [x], [f x], [f (f x)], and so on. In other words, it is the orbit of the function [f], starting at [x]. @since 4.14 n??o@y@@@@@@@@`@@'@@@@@@@P< {1 Transforming sequences} @@@@@@@@@@3@bu1@A | The functions in this section are lazy: that is, they return sequences whose elements are computed only when demanded. @@@A1@@@@@@#map3A3A7A3A:@б@б@А!a@9B@/)A3A>A3A@@@А!b@;B@04A3ADA3AF@@@ @@19@@б@гQ!tA3ANA3AO@А!a%IA3AKA3AM@@@+@@@3P @@гf!tA3AVA3AW@А!b/^A3ASA3AU@@@5@@@5e @@@@@6h@@@4@@7kA3A=@@@A3A3@] [map f xs] is the image of the sequence [xs] through the transformation [f]. If [xs] is the sequence [x0; x1; ...] then [map f xs] is the sequence [f x0; f x1; ...].  AXAX AB@@@@@@@#a@@'@m@@@@@@$mapi4!BB"BB@б@б@г#int.BB/BB"@@ @@@<30//00000@:@A@@б@А!a@HB@= ABB&BBB(@@А!b@JB@>LBB,MBB.@@@ @@?@@@#@@@ &@@б@гݠ!t]BB6^BB7@А!a(0dBB3eBB5@@@.@@@B7 @@г!trBB>sBB?@А!b2EyBB;zBB=@@@8@@@DL @@@@@EO@@@4@@FRBB@@@BB@鐠 [mapi] is analogous to [map], but applies the function [f] to an index and an element. [mapi f xs] is equivalent to [map2 f (ints 0) xs]. @since 4.14 B@B@BB@@@@@@@b@@'@@@@@@@r&filter5BBBB@б@б@А!a@UB@K3@6@ABBBB@@г$boolBCBC@@ @@@L@@@@@M@@б@гY!tBC BC @А!a)$BC BC @@@/@@@O+ @@гn!tBCBC@А!a>9BCBC@@@D@@@Q@ @@@@@RC@@@4@@SFBB@@@BB@e [filter p xs] is the sequence of the elements [x] of [xs] that satisfy [p x]. In other words, [filter p xs] is the sequence [xs], deprived of the elements [x] such that [p x] is false. CCCC@@@@@@@+c@@'@u&@@@@@@f'filteri6)CC*CC@б@б@г #int6CC7CC@@ @@@V387788888@:@A@@б@А!a@bB@W ICCJCC@@г$boolRCDSCD@@ @@@X@@@@@Y@@@%@@Z"( @@б@г砐!tgCD hCD @А!a*2nCD oCD @@@0@@@\9 @@г!t|CD}CD@А!a?GCDCD@@@E@@@^N @@@@@_Q@@@4@@`TCC@@@CC@󐠠 Same as {!filter}, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument. @since 5.4 DDDD@@@@@@@d@@'@@@@@@@t*filter_map7DDDD@б@б@А!a@oB@c3@6@ADDDD@@г0&optionDDDD@А!b@qB@dDDDD@@@ @@@f@@@&@@g!@@б@гp!tDDDD@А!a61DDDD@@@<@@@i8 @@г!tDEDE@А!b4F DD DD@@@:@@@kM @@@@@lP@@@4@@mSDD@@@DD@| [filter_map f xs] is the sequence of the elements [y] such that [f x = Some y], where [x] ranges over [xs]. [filter_map f xs] is equivalent to [map Option.get (filter Option.is_some (map f xs))]. )EE*EE@@@@@@@Be@@'@=@@@@@@s$scan8@EEAEE@б@б@А!b@B@r3KJJKKKKK@6@AQEEREE@@б@А!a@~B@s^EE_EE@@А!bdEEeEE@@@@@t @@@"@@u@@б@А!b(#rEEsEE@@б@г!t}EF~EF@А!a+5EFEF@@@1@@@w< @@г!tEF EF @А!bOJEFEF @@@U@@@yQ @@@@@zT@@@\@@{W4@@@?@@|ZEE@@@EE@ Y If [xs] is a sequence [[x0; x1; x2; ...]], then [scan f a0 xs] is a sequence of accumulators [[a0; a1; a2; ...]] where [a1] is [f a0 x0], [a2] is [f a1 x1], and so on. Thus, [scan f a0 xs] is conceptually related to [fold_left f a0 xs]. However, instead of performing an eager iteration and immediately returning the final accumulator, it returns a sequence of accumulators. For instance, [scan (+) 0] transforms a sequence of integers into the sequence of its partial sums. If [xs] has length [n] then [scan f a0 xs] has length [n+1]. @since 4.14 F F HYHk@@@@@@@f@@*@͐@@@@@@z$take9HmHqHmHu@б@г#intHmHxHmH{@@ @@@3@8@A@@б@гl!tHmHHmH@А!a@B@HmHHmH@@@ @@@@@г!tHmHHmH@А!a, HmHHmH@@@ @@@3 @@@@@6@@@<@@9?@@@HmHm@| [take n xs] is the sequence of the first [n] elements of [xs]. If [xs] has fewer than [n] elements, then [take n xs] is equivalent to [xs]. [n] must be nonnegative. @raise Invalid_argument if [n] is negative. @since 4.14 )HH*IuI@@@@@@@Bg@@&@=@@@@@@X$drop:@IIAII@б@г#intKIILII@@ @@@3MLLMMMMM@q8@A@@б@гܠ!t\II]II@А!a@B@hIIiII@@@ @@@@@г!tvIIwII@А!a,}II~II@@@ @@@3 @@@@@6@@@<@@9?@@@II@쐠  [drop n xs] is the sequence [xs], deprived of its first [n] elements. If [xs] has fewer than [n] elements, then [drop n xs] is empty. [n] must be nonnegative. [drop] is lazy: the first [n+1] elements of the sequence [xs] are demanded only when the first element of [drop n xs] is demanded. @raise Invalid_argument if [n] is negative. @since 4.14 II KK-@@@@@@@h@@&@@@@@@@X*take_while;K/K3K/K=@б@б@А!a@B@3@o6@AK/KAK/KC@@г$boolK/KGK/KK@@ @@@@@@@@@@б@г\!tK/KSK/KT@А!a)$K/KPK/KR@@@/@@@+ @@гq!tK/K[K/K\@А!a>9K/KXK/KZ@@@D@@@@ @@@@@C@@@4@@FK/K@@@@K/K/@h | [take_while p xs] is the longest prefix of the sequence [xs] where every element [x] satisfies [p x]. @since 4.14 K]K]KK@@@@@@@.i@@'@x)@@@@@@f*drop_while<,KK-KK@б@б@А!a@B@376677777@}6@A=KK>KK@@г$boolFKKGKK@@ @@@@@@@@@@б@гؠ!tXKLYKL@А!a)$_KL`KL@@@/@@@+ @@г!tmKL nKL @А!a>9tKL uKL @@@D@@@@ @@@@@C@@@4@@FKK@@@KK@䐠 h [drop_while p xs] is the sequence [xs], deprived of the prefix [take_while p xs]. @since 4.14 LLLiL{@@@@@@@j@@'@@@@@@@f%group=L}LL}L@б@б@А!a@B@3@}6@AL}LL}L@@б@А!a L}LL}L@@г$boolL}LL}L@@ @@@@@@!@@@@@$@@ @@б@г_!tL}LL}L@А!a4/L}LL}L@@@:@@@6 @@гt!tL}LL}L@г~!tL}LL}L@А!aSNL}LL}L@@@Y@@@U @@@@@@Z @@@+@@].@@@C@@`L}L#@@@L}L}&@z  Provided the function [eq] defines an equality on elements, [group eq xs] is the sequence of the maximal runs of adjacent duplicate elements of the sequence [xs]. Every element of [group eq xs] is a nonempty sequence of equal elements. The concatenation [concat (group eq xs)] is equal to [xs]. Consuming [group eq xs], and consuming the sequences that it contains, can cause [xs] to be consumed more than once. Therefore, [xs] must be persistent. @since 4.14 'LL('NN@@@@@@@@k@@6@;@@@@@@'memoize>>)NN?)NN@б@гɠ!tI)NNJ)NN@А!a@B@3QPPQQQQQ@>@AW)NNX)NN@@@ @@@ @@г堐!te)NNf)NN@А!al)NNm)NN@@@"@@@ @@@@@!@@@x)NN@ؐ  The sequence [memoize xs] has the same elements as the sequence [xs]. Regardless of whether [xs] is ephemeral or persistent, [memoize xs] is persistent: even if it is queried several times, [xs] is queried at most once. The construction of the sequence [memoize xs] internally relies on suspensions provided by the module {!Lazy}. These suspensions are {i not} thread-safe. Therefore, the sequence [memoize xs] must {i not} be queried by multiple threads concurrently. @since 4.14 *NN5PP@@@@@@@l@@#@@@@@@@@,Forced_twice?B7PP7PP@#@@@A7PP@ This exception is raised when a sequence returned by {!once} (or a suffix of it) is queried more than once. @since 4.14 8PP;QYQk@@@@@@@m@@@@Đ@@@@@@@3@lK@A $@$once@=QmQq=QmQu@б@гU!t=QmQ{=QmQ|@А!a@C@3@"IC@A=QmQx=QmQz@@@ @@@ @@гq!t=QmQ=QmQ@А!a=QmQ=QmQ@@@"@@@ @@@@@!@@@=QmQm@d  The sequence [once xs] has the same elements as the sequence [xs]. Regardless of whether [xs] is ephemeral or persistent, [once xs] is an ephemeral sequence: it can be queried at most once. If it (or a suffix of it) is queried more than once, then the exception [Forced_twice] is raised. This can be useful, while debugging or testing, to ensure that a sequence is consumed at most once. @raise Forced_twice if [once xs], or a suffix of it, is queried more than once. @since 4.14 >QQISS@@@@@@@*n@@#@t%@@@@@@@)transposeA(KSS)KSS@б@г!t3KSS4KSS@г!t=KSS>KSS@А!a@C@3EDDEEEEE@iH@AKKSSLKSS@@@ @@@ @@@&@@@ #@@гޠ!t^KSS_KSS@г蠐!thKSSiKSS@А!a+&oKSSpKSS@@@1@@@- @@@@@@2 @@@+@@53@@@KSS"@ J If [xss] is a matrix (a sequence of rows), then [transpose xss] is the sequence of the columns of the matrix [xss]. The rows of the matrix [xss] are not required to have the same length. The matrix [xss] is not required to be finite (in either direction). The matrix [xss] must be persistent. @since 4.14 LSSUTU@@@@@@@o@@2@@@@@@@T9 {1 Combining sequences} WU U WU U'@@@@@@3@f1@A&appendBYU)U-YU)U3@б@гB!tYU)U9YU)U:@А!a@C@ YU)U6YU)U8@@@ @@@'@@б@г^!tYU)UAYU)UB@А!a7YU)U>YU)U@@@@"@@@> @@гs!tYU)UIYU)UJ@А!a1LYU)UFYU)UH@@@7@@@S @@@@@V@@@6@@Y9@@@ YU)U)@i [append xs ys] is the concatenation of the sequences [xs] and [ys]. Its elements are the elements of [xs], followed by the elements of [ys]. @since 4.11 ZUKUK^UU@@@@@@@/p@@&@y*@@@@@@x&concatC-`UU.`UV@б@г!t8`UV9`UV @г !tB`UVC`UV@А!a@C@3JIIJJJJJ@H@AP`UVQ`UV@@@ @@@ @@@&@@@ #@@г㠐!tc`UVd`UV@А!a!j`UV k`UV@@@'@@@# @@@@@&$@@@v`UU@֐ If [xss] is a sequence of sequences, then [concat xss] is its concatenation. If [xss] is the sequence [xs0; xs1; ...] then [concat xss] is the sequence [xs0 @ xs1 @ ...]. @since 4.13 aVVgVV@@@@@@@q@@#@@@@@@@E(flat_mapDiVViVV@б@б@А!a@C@3@\6@AiVViVV@@г4!tiVViVV@А!b@C@iVViVV@@@ @@@@@@&@@!@@б@гS!tiVWiVW@А!a61iVWiVW@@@<@@@8 @@гh!tiVW iVW@А!b4FiVW iVW @@@:@@@M @@@@@P@@@4@@SiVV@@@iVV@_ 7 [flat_map f xs] is equivalent to [concat (map f xs)].  jWW jWWK@@@@@@@%r@@'@o @@@@@@s*concat_mapE#lWMWQ$lWMW[@б@б@А!a@C@3.--.....@6@A4lWMW_5lWMWa@@г!t=lWMWh>lWMWi@А!b@C@IlWMWeJlWMWg@@@ @@@@@@&@@!@@б@гܠ!t\lWMWq]lWMWr@А!a61clWMWndlWMWp@@@<@@@8 @@г!tqlWMWyrlWMWz@А!b4FxlWMWvylWMWx@@@:@@@M @@@@@P@@@4@@SlWMW^@@@lWMWM@萠 x [concat_map f xs] is equivalent to [concat (map f xs)]. [concat_map] is an alias for [flat_map]. @since 4.13 mW{W{qWW@@@@@@@s@@'@@@@@@@s#zipFsWWsWX@б@г7!tsWXsWX@А!a@C@ 3@>@AsWXsWX@@@ @@@  @@б@гU!tsWXsWX@А!b@C@ sWX sWX@@@ @@@%@@гo!tsWXsWX@В@А!a<7sWXsWX@@@А!b&?sWXsWX@@@@K@/@@H@@@# @@@MsWX!@@@0@@Q3$@@@O@@TR'@@@sWW*@y v [zip xs ys] is the sequence of pairs [(x, y)] drawn synchronously from the sequences [xs] and [ys]. If the sequences [xs] and [ys] have different lengths, then the sequence ends as soon as one sequence is exhausted; the excess elements in the other sequence are ignored. [zip xs ys] is equivalent to [map2 (fun a b -> (a, b)) xs ys]. @since 4.14 &tX X '}YY@@@@@@@?t@@:@:@@@@@@s$map2G=YY>YY@б@б@А!a@'C@3HGGHHHHH@6@ANYYOYY@@б@А!b@)C@[YY\YY@@А!c@+C@fYYgYY@@@ @@@@@'@@" @@б@г!twYYxYY@А!a72~YYYY@@@=@@@9 @@б@г!tYYYY@А!b?IYYYY@@@E@@@ P @@г#!tYYYY@А!cI^YYYY@@@O@@@"e @@@@@#h@@@6@@$k9@@@N@@%nYY@@@YY@  [map2 f xs ys] is the sequence of the elements [f x y], where the pairs [(x, y)] are drawn synchronously from the sequences [xs] and [ys]. If the sequences [xs] and [ys] have different lengths, then the sequence ends as soon as one sequence is exhausted; the excess elements in the other sequence are ignored. [map2 f xs ys] is equivalent to [map (fun (x, y) -> f x y) (zip xs ys)]. @since 4.14 YY[o[@@@@@@@u@@*@-ސ@@@@@@*interleaveH[[[[@б@гl!t[[[[@А!a@6C@,3@>@A[[[[@@@ @@@. @@б@г!t [[ [[@А!a[[[[@@@$@@@0  @@г!t[[ [[@А!a3.&[['[[@@@9@@@25 @@@@@38@@@6@@4;9@@@5[[@  [interleave xs ys] is the sequence that begins with the first element of [xs], continues with the first element of [ys], and so on. When one of the sequences [xs] and [ys] is exhausted, [interleave xs ys] continues with the rest of the other sequence. @since 4.14 B[[C\\@@@@@@@@@&@V@@@@@@Z,sorted_mergeIY\\Z\\@б@б@А!a@EC@73dccddddd@q6@Aj\\k\\@@б@А!a r\\s\\@@гN#int{\\|\\@@ @@@8@@@!@@9@@@$@@: @@б@г!t\\\\@А!a4/\\\\@@@:@@@<6 @@б@г'!t\\\\@А!aKF\\\\@@@Q@@@>M @@г@A^"^0^"^2@@@ @@@H @@б@г!t#^"^;$^"^<@А!b@TC@I/^"^80^"^:@@@ @@@K%@@г!t=^"^J>^"^K@В@А!a<7H^"^AI^"^C@@@А!b&?P^"^FQ^"^H@@@@K@/@@LH@@@# @@@NM^^"^@!@@@0@@OQ3$@@@O@@PTR'@@@g^"^"*@ǐ  [product xs ys] is the Cartesian product of the sequences [xs] and [ys]. For every element [x] of [xs] and for every element [y] of [ys], the pair [(x, y)] appears once as an element of [product xs ys]. The order in which the pairs appear is unspecified. The sequences [xs] and [ys] are not required to be finite. The sequences [xs] and [ys] must be persistent. @since 4.14 t^L^Lu__@@@@@@@x@@:@@@@@@@s+map_productK____@б@б@А!a@dC@U3@6@A____@@б@А!b@fC@V_`_`@@А!c@hC@W_`_`@@@ @@X@@@'@@Y" @@б@гE!t_`_`@А!a72_` _`@@@=@@@[9 @@б@г\!t_`_`@А!b?I_`_`@@@E@@@]P @@гq!t_` _`!@А!cI^_`_`@@@O@@@_e @@@@@`h@@@6@@ak9@@@N@@bn__@@@ __@k . The sequence [map_product f xs ys] is the image through [f] of the Cartesian product of the sequences [xs] and [ys]. For every element [x] of [xs] and for every element [y] of [ys], the element [f x y] appears once as an element of [map_product f xs ys]. The order in which these elements appear is unspecified. The sequences [xs] and [ys] are not required to be finite. The sequences [xs] and [ys] must be persistent. [map_product f xs ys] is equivalent to [map (fun (x, y) -> f x y) (product xs ys)]. @since 4.14 `"`"bCbU@@@@@@@1y@@*@{,@@@@@@:9 - {1 Splitting a sequence into two sequences} 6bWbW7bWb@@@@@@354455555@1@A%unzipLBbbCbb@б@г͠!tMbbNbb@В@А!a@uC@i$]bb^bb@@@А!b@wC@j1jbbkbb@@@@@@@k:@@@- @@@m?xbb+@@В@г!tbbbb@А!a3Rbbbb@@@9@@@oY @@@г!tbbbb@А!b=ibbbb@@@C@@@qp @@@@ @ @@rw%@@@? @@sz;@@@bb@  [unzip] transforms a sequence of pairs into a pair of sequences. [unzip xs] is equivalent to [(map fst xs, map snd xs)]. Querying either of the sequences returned by [unzip xs] causes [xs] to be queried. Therefore, querying both of them causes [xs] to be queried twice. Thus, [xs] must be persistent and cheap. If that is not the case, use [unzip (memoize xs)]. @since 4.14 bbd?dQ@@@@@@@z@@*@%֐@@@@@@%splitMdSdWdSd\@б@гd!tdSdidSdj@В@А!a@C@x3@B@AdSd`dSdb@@@А!b@C@ydSdedSdg@@@@@@@z@@@/ @@@|dSd_-@@В@г!tdSdqdSdr@А!a50$dSdn%dSdp@@@;@@@~7 @@@г!t4dSdx5dSdy@А!b=G;dSdu<dSdw@@@C@@@N @@@@ @ @@U%@@@? @@X;@@@NdSdS@ 3 [split] is an alias for [unzip]. @since 4.14 [dzdz\dd@@@@@@@t{@@*@o@@@@@@w-partition_map`rddsdd@б@б@А!a@ uC@3}||}}}}}@6@Adddd@@г&Either!tdddd@ dddd@@А!b@ wC@ e dddd@@А!c@ yC@ f,dddd@@@* @@@ i4dd!@@@= @@ j86$@@б@гB!tdddd@А!aMHdddd@@@S@@@ lO @@В@г[!tdddd@А!bFadddd@@@L@@@ nh @@@гr!tdddd@А!cQxdddd@@@W@@@ p @@@@ @ @@ q%@@@> @@ rA@@@V@@ s dd@@@dd@p  [partition_map f xs] returns a pair of sequences [(ys, zs)], where: - [ys] is the sequence of the elements [y] such that [f x = Left y], where [x] ranges over [xs]; - [zs] is the sequence of the elements [z] such that [f x = Right z], where [x] ranges over [xs]. [partition_map f xs] is equivalent to a pair of [filter_map Either.find_left (map f xs)] and [filter_map Either.find_right (map f xs)]. Querying either of the sequences returned by [partition_map f xs] causes [xs] to be queried. Therefore, querying both of them causes [xs] to be queried twice. Thus, [xs] must be persistent and cheap. If that is not the case, use [partition_map f (memoize xs)]. @since 4.14 ddgg@@@@@@@6|@@.@1@@@@@@)partitiona4gg5gg@б@б@А!a@ C@ z3?>>?????@6@AEggFgg@@г $boolNggOgg@@ @@@ {@@@@@ |@@б@гࠐ!t`ghagh@А!a)$gghhgh@@@/@@@ ~+ @@В@г!tygh zgh@А!aB=gh gh @@@H@@@ D @@@г!tghgh@А!aYTghgh@@@_@@@ [ @@@@ @ @@ b%@@@> @@ eA@@@V@@ hgg@@@gg@ m [partition p xs] returns a pair of the subsequence of the elements of [xs] that satisfy [p] and the subsequence of the elements of [xs] that do not satisfy [p]. [partition p xs] is equivalent to [filter p xs, filter (fun x -> not (p x)) xs]. Consuming both of the sequences returned by [partition p xs] causes [xs] to be consumed twice and causes the function [f] to be applied twice to each element of the list. Therefore, [f] should be pure and cheap. Furthermore, [xs] should be persistent and cheap. If that is not the case, use [partition p (memoize xs)]. @since 4.14 hhjvj@@@@@@@}@@.@ϐ@@@@@@ܐ 1 {1 Converting between sequences and dispensers} jjjj@@@@@@3@1@A r A dispenser is a representation of a sequence as a function of type [unit -> 'a option]. Every time this function is invoked, it returns the next element of the sequence. When there are no more elements, it returns [None]. A dispenser has mutable internal state, therefore is ephemeral: the sequence that it represents can be consumed at most once. jjl-l9@@@@@@,of_dispenserbl;l?l;lK@б@б@г$unit l;lO l;lS@@ @@@ -@@гo&option l;lZ l;l`@А!a@ C@ @ l;lW l;lY@@@ @@@ G@@@ @@ J#@@г!t -l;lh .l;li@А!aX 4l;le 5l;lg@@@#@@@ _ @@@@@ b >l;lN@@@ Al;l;@ [of_dispenser it] is the sequence of the elements produced by the dispenser [it]. It is an ephemeral sequence: it can be consumed at most once. If a persistent sequence is needed, use [memoize (of_dispenser it)]. @since 4.14  Nljlj O mPmb@@@@@@@ g~@@$@ b@@@@@@,to_dispenserc e mdmh f mdmt@б@г!t p mdmz q mdm{@А!a@ C@ 3 x w w x x x x x@>@A ~ mdmw  mdmy@@@ @@@  @@б@г ;$unit  mdm  mdm@@ @@@ @@г&option  mdm  mdm@А!a+&  mdm  mdm@@@1@@@ - @@@@@ 0@@@.@@ 31  mdm@@@  mdmd@ [to_dispenser xs] is a fresh dispenser on the sequence [xs]. This dispenser has mutable internal state, which is not protected by a lock; so, it must not be used by several threads concurrently. @since 4.14   mm nhnz@@@@@@@ @@@" Ӑ@@@@@@S  ; {1 Sequences of integers}  n|n| n|n@@@@@@3        @e1@A$intsd nn nn@б@г Ǡ#int nn nn@@ @@@ @@г!t!nn!nn@г ޠ#int! nn! nn@@ @@@ 1@@@@@@ 6 @@@"@@ 9%@@@!nn@{ j [ints i] is the infinite sequence of the integers beginning at [i] and counting up. @since 4.14 !(nn!)oo%@@@@@@@!A@@@*@!<@@@@@@X@hA@B@s@S@@.@@+@ @z(@@<@@4@@{@V@6@@@b@@b5@@@a@@c6@@z@Z@|@\@x@X@e@E @  i@ I @  @ a @  s@ S @  B@  @ o @  @ n #@ @|@@f@n@N@@@ @k@_@?@@r@R@@@3!!!!!!!!@@A@ H************************************************************************!A@@!A@L@ H !BMM!BM@ H OCaml !C!C@ H !D!D3@ H Simon Cruanes !E44!E4@ H !F!F@ H Copyright 2017 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 !J!J@ H the GNU Lesser General Public License version 2.1, with the !K!KN@ H special exception on linking described in the file LICENSE. !LOO!LO@ H "M"M@ H************************************************************************" N" N5@ v* Sequences. A sequence of type ['a Seq.t] can be thought of as a {b delayed list}, that is, a list whose elements are computed only when they are demanded by a consumer. This allows sequences to be produced and transformed lazily (one element at a time) rather than eagerly (all elements at once). This also allows constructing conceptually infinite sequences. The type ['a Seq.t] is defined as a synonym for [unit -> 'a Seq.node]. This is a function type: therefore, it is opaque. The consumer can {b query} a sequence in order to request the next element (if there is one), but cannot otherwise inspect the sequence in any way. Because it is opaque, the type ['a Seq.t] does {i not} reveal whether a sequence is: - {b persistent}, which means that the sequence can be used as many times as desired, producing the same elements every time, just like an immutable list; or - {b ephemeral}, which means that the sequence is not persistent. Querying an ephemeral sequence might have an observable side effect, such as incrementing a mutable counter. As a common special case, an ephemeral sequence can be {b affine}, which means that it must be queried at most once. It also does {i not} reveal whether the elements of the sequence are: - {b pre-computed and stored} in memory, which means that querying the sequence is cheap; - {b computed when first demanded and then stored} in memory, which means that querying the sequence once can be expensive, but querying the same sequence again is cheap; or - {b re-computed every time they are demanded}, which may or may not be cheap. It is up to the programmer to keep these distinctions in mind so as to understand the time and space requirements of sequences. For the sake of simplicity, most of the documentation that follows is written under the implicit assumption that the sequences at hand are persistent. We normally do not point out {i when} or {i how many times} each function is invoked, because that would be too verbose. For instance, in the description of [map], we write: "if [xs] is the sequence [x0; x1; ...] then [map f xs] is the sequence [f x0; f x1; ...]". If we wished to be more explicit, we could point out that the transformation takes place on demand: that is, the elements of [map f xs] are computed only when they are demanded. In other words, the definition [let ys = map f xs] terminates immediately and does not invoke [f]. The function call [f x0] takes place only when the first element of [ys] is demanded, via the function call [ys()]. Furthermore, calling [ys()] twice causes [f x0] to be called twice as well. If one wishes for [f] to be applied at most once to each element of [xs], even in scenarios where [ys] is queried more than once, then one should use [let ys = memoize (map f xs)]. As a general rule, the functions that build sequences, such as [map], [filter], [scan], [take], etc., produce sequences whose elements are computed only on demand. The functions that eagerly consume sequences, such as [is_empty], [find], [length], [iter], [fold_left], etc., are the functions that force computation to take place. When possible, we recommend using sequences rather than dispensers (functions of type [unit -> 'a option] that produce elements upon demand). Whereas sequences can be persistent or ephemeral, dispensers are always ephemeral, and are typically more difficult to work with than sequences. Two conversion functions, {!to_dispenser} and {!of_dispenser}, are provided. @since 4.07 " P* A sequence [xs] of type ['a t] is a delayed list of elements of type ['a]. Such a sequence is queried by performing a function application [xs()]. This function application returns a node, allowing the caller to determine whether the sequence is empty or nonempty, and in the latter case, to obtain its head and tail.  c!*"c<R"c<V@ * A node is either [Nil], which means that the sequence is empty, or [Cons (x, xs)], which means that [x] is the first element of the sequence and that [xs] is the remainder of the sequence.  Q:* {1 Consuming sequences}  * The functions in this section consume their argument, a sequence, either partially or completely: - [is_empty] and [uncons] consume the sequence down to depth 1. That is, they demand the first argument of the sequence, if there is one. - [iter], [fold_left], [length], etc., consume the sequence all the way to its end. They terminate only if the sequence is finite. - [for_all], [exists], [find], etc. consume the sequence down to a certain depth, which is a priori unpredictable. Similarly, among the functions that consume two sequences, one can distinguish two groups: - [iter2] and [fold_left2] consume both sequences all the way to the end, provided the sequences have the same length. - [for_all2], [exists2], [equal], [compare] consume the sequences down to a certain depth, which is a priori unpredictable. The functions that consume two sequences can be applied to two sequences of distinct lengths: in that case, the excess elements in the longer sequence are ignored. (It may be the case that one excess element is demanded, even though this element is not used.) None of the functions in this section is lazy. These functions are consumers: they force some computation to take place.  F* [is_empty xs] determines whether the sequence [xs] is empty. It is recommended that the sequence [xs] be persistent. Indeed, [is_empty xs] demands the head of the sequence [xs], so, if [xs] is ephemeral, it may be the case that [xs] cannot be used any more after this call has taken place. @since 4.14 K * If [xs] is empty, then [uncons xs] is [None]. If [xs] is nonempty, then [uncons xs] is [Some (x, ys)] where [x] is the head of the sequence and [ys] its tail. @since 4.14 ͠ p* [length xs] is the length of the sequence [xs]. Does not terminate if [xs] is infinite. @since 4.14 z * [iter f xs] invokes [f x] successively for every element [x] of the sequence [xs], from left to right. It terminates only if the sequence [xs] is finite.  * [fold_left f _ xs] invokes [f _ x] successively for every element [x] of the sequence [xs], from left to right. An accumulator of type ['a] is threaded through the calls to [f]. It terminates only if the sequence [xs] is finite.  * [iteri f xs] invokes [f i x] successively for every element [x] located at index [i] in the sequence [xs]. It terminates only if the sequence [xs] is finite. [iteri f xs] is equivalent to [iter (fun (i, x) -> f i x) (zip (ints 0) xs)]. @since 4.14  * [fold_lefti f _ xs] invokes [f _ i x] successively for every element [x] located at index [i] of the sequence [xs]. An accumulator of type ['b] is threaded through the calls to [f]. It terminates only if the sequence [xs] is finite. [fold_lefti f accu xs] is equivalent to [fold_left (fun accu (i, x) -> f accu i x) accu (zip (ints 0) xs)]. @since 4.14 x * [for_all p xs] determines whether all elements [x] of the sequence [xs] satisfy [p x]. May not terminate if [xs] is infinite. @since 4.14  * [exists p xs] determines whether at least one element [x] of the sequence [xs] satisfies [p x]. May not terminate if [xs] is infinite. @since 4.14  * [find p xs] returns [Some x], where [x] is the first element of the sequence [xs] that satisfies [p x], if there is such an element. It returns [None] if there is no such element. May not terminate if [xs] is infinite. @since 4.14  * [find_index p xs] returns [Some i], where [i] is the index of the first element of the sequence [xs] that satisfies [p x], if there is such an element. It returns [None] if there is no such element. May not terminate if [xs] is infinite. @since 5.1  4* [find_map f xs] returns [Some y], where [x] is the first element of the sequence [xs] such that [f x = Some _], if there is such an element, and where [y] is defined by [f x = Some y]. It returns [None] if there is no such element. May not terminate if [xs] is infinite. @since 4.14  * Same as [find_map], but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument. May not terminate if [xs] is infinite. @since 5.1  * [iter2 f xs ys] invokes [f x y] successively for every pair [(x, y)] of elements drawn synchronously from the sequences [xs] and [ys]. If the sequences [xs] and [ys] have different lengths, then iteration stops as soon as one sequence is exhausted; the excess elements in the other sequence are ignored. Iteration terminates only if at least one of the sequences [xs] and [ys] is finite. [iter2 f xs ys] is equivalent to [iter (fun (x, y) -> f x y) (zip xs ys)]. @since 4.14 䠠 r* [fold_left2 f _ xs ys] invokes [f _ x y] successively for every pair [(x, y)] of elements drawn synchronously from the sequences [xs] and [ys]. An accumulator of type ['a] is threaded through the calls to [f]. If the sequences [xs] and [ys] have different lengths, then iteration stops as soon as one sequence is exhausted; the excess elements in the other sequence are ignored. Iteration terminates only if at least one of the sequences [xs] and [ys] is finite. [fold_left2 f accu xs ys] is equivalent to [fold_left (fun accu (x, y) -> f accu x y) (zip xs ys)]. @since 4.14 < * [for_all2 p xs ys] determines whether all pairs [(x, y)] of elements drawn synchronously from the sequences [xs] and [ys] satisfy [p x y]. If the sequences [xs] and [ys] have different lengths, then iteration stops as soon as one sequence is exhausted; the excess elements in the other sequence are ignored. In particular, if [xs] or [ys] is empty, then [for_all2 p xs ys] is true. This is where [for_all2] and [equal] differ: [equal eq xs ys] can be true only if [xs] and [ys] have the same length. May not terminate if both of the sequences [xs] and [ys] are infinite. [for_all2 p xs ys] is equivalent to [for_all (fun b -> b) (map2 p xs ys)]. @since 4.14  * [exists2 p xs ys] determines whether some pair [(x, y)] of elements drawn synchronously from the sequences [xs] and [ys] satisfies [p x y]. If the sequences [xs] and [ys] have different lengths, then iteration must stop as soon as one sequence is exhausted; the excess elements in the other sequence are ignored. May not terminate if both of the sequences [xs] and [ys] are infinite. [exists2 p xs ys] is equivalent to [exists (fun b -> b) (map2 p xs ys)]. @since 4.14  * Provided the function [eq] defines an equality on elements, [equal eq xs ys] determines whether the sequences [xs] and [ys] are pointwise equal. May not terminate if both of the sequences [xs] and [ys] are infinite. @since 4.14 k G* Provided the function [cmp] defines a preorder on elements, [compare cmp xs ys] compares the sequences [xs] and [ys] according to the lexicographic preorder. For more details on comparison functions, see {!Array.sort}. May not terminate if both of the sequences [xs] and [ys] are infinite. @since 4.14 Р=* {1 Constructing sequences}  }* The functions in this section are lazy: that is, they return sequences whose elements are computed only when demanded.  J* [empty] is the empty sequence. It has no elements. Its length is 0. s M* [return x] is the sequence whose sole element is [x]. Its length is 1. ' H* [cons x xs] is the sequence that begins with the element [x], followed with the sequence [xs]. Writing [cons (f()) xs] causes the function call [f()] to take place immediately. For this call to be delayed until the sequence is queried, one must instead write [(fun () -> Cons(f(), xs))]. @since 4.11  V* [singleton x] returns the one-element sequence containing only [x]. @since 5.4 u * [init n f] is the sequence [f 0; f 1; ...; f (n-1)]. [n] must be nonnegative. If desired, the infinite sequence [f 0; f 1; ...] can be defined as [map f (ints 0)]. @raise Invalid_argument if [n] is negative. @since 4.14  * [unfold] constructs a sequence out of a step function and an initial state. If [f u] is [None] then [unfold f u] is the empty sequence. If [f u] is [Some (x, u')] then [unfold f u] is the nonempty sequence [cons x (unfold f u')]. For example, [unfold (function [] -> None | h :: t -> Some (h, t)) l] is equivalent to [List.to_seq l]. @since 4.11 y * [repeat x] is the infinite sequence where the element [x] is repeated indefinitely. [repeat x] is equivalent to [cycle (return x)]. @since 4.14 - * [forever f] is an infinite sequence where every element is produced (on demand) by the function call [f()]. For instance, [forever Random.bool] is an infinite sequence of random bits. [forever f] is equivalent to [map f (repeat ())]. @since 4.14 Π n* [cycle xs] is the infinite sequence that consists of an infinite number of repetitions of the sequence [xs]. If [xs] is an empty sequence, then [cycle xs] is empty as well. Consuming (a prefix of) the sequence [cycle xs] once can cause the sequence [xs] to be consumed more than once. Therefore, [xs] must be persistent. @since 4.14 s * [iterate f x] is the infinite sequence whose elements are [x], [f x], [f (f x)], and so on. In other words, it is the orbit of the function [f], starting at [x]. @since 4.14 =* {1 Transforming sequences}  }* The functions in this section are lazy: that is, they return sequences whose elements are computed only when demanded. 堠 * [map f xs] is the image of the sequence [xs] through the transformation [f]. If [xs] is the sequence [x0; x1; ...] then [map f xs] is the sequence [f x0; f x1; ...]. } * [mapi] is analogous to [map], but applies the function [f] to an index and an element. [mapi f xs] is equivalent to [map2 f (ints 0) xs]. @since 4.14  * [filter p xs] is the sequence of the elements [x] of [xs] that satisfy [p x]. In other words, [filter p xs] is the sequence [xs], deprived of the elements [x] such that [p x] is false. { * Same as {!filter}, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument. @since 5.4  * [filter_map f xs] is the sequence of the elements [y] such that [f x = Some y], where [x] ranges over [xs]. [filter_map f xs] is equivalent to [map Option.get (filter Option.is_some (map f xs))]. j Z* If [xs] is a sequence [[x0; x1; x2; ...]], then [scan f a0 xs] is a sequence of accumulators [[a0; a1; a2; ...]] where [a1] is [f a0 x0], [a2] is [f a1 x1], and so on. Thus, [scan f a0 xs] is conceptually related to [fold_left f a0 xs]. However, instead of performing an eager iteration and immediately returning the final accumulator, it returns a sequence of accumulators. For instance, [scan (+) 0] transforms a sequence of integers into the sequence of its partial sums. If [xs] has length [n] then [scan f a0 xs] has length [n+1]. @since 4.14 ݠ * [take n xs] is the sequence of the first [n] elements of [xs]. If [xs] has fewer than [n] elements, then [take n xs] is equivalent to [xs]. [n] must be nonnegative. @raise Invalid_argument if [n] is negative. @since 4.14 p * [drop n xs] is the sequence [xs], deprived of its first [n] elements. If [xs] has fewer than [n] elements, then [drop n xs] is empty. [n] must be nonnegative. [drop] is lazy: the first [n+1] elements of the sequence [xs] are demanded only when the first element of [drop n xs] is demanded. @raise Invalid_argument if [n] is negative. @since 4.14  }* [take_while p xs] is the longest prefix of the sequence [xs] where every element [x] satisfies [p x]. @since 4.14  i* [drop_while p xs] is the sequence [xs], deprived of the prefix [take_while p xs]. @since 4.14   * Provided the function [eq] defines an equality on elements, [group eq xs] is the sequence of the maximal runs of adjacent duplicate elements of the sequence [xs]. Every element of [group eq xs] is a nonempty sequence of equal elements. The concatenation [concat (group eq xs)] is equal to [xs]. Consuming [group eq xs], and consuming the sequences that it contains, can cause [xs] to be consumed more than once. Therefore, [xs] must be persistent. @since 4.14  ~ * The sequence [memoize xs] has the same elements as the sequence [xs]. Regardless of whether [xs] is ephemeral or persistent, [memoize xs] is persistent: even if it is queried several times, [xs] is queried at most once. The construction of the sequence [memoize xs] internally relies on suspensions provided by the module {!Lazy}. These suspensions are {i not} thread-safe. Therefore, the sequence [memoize xs] must {i not} be queried by multiple threads concurrently. @since 4.14  # * This exception is raised when a sequence returned by {!once} (or a suffix of it) is queried more than once. @since 4.14   * The sequence [once xs] has the same elements as the sequence [xs]. Regardless of whether [xs] is ephemeral or persistent, [once xs] is an ephemeral sequence: it can be queried at most once. If it (or a suffix of it) is queried more than once, then the exception [Forced_twice] is raised. This can be useful, while debugging or testing, to ensure that a sequence is consumed at most once. @raise Forced_twice if [once xs], or a suffix of it, is queried more than once. @since 4.14  K* If [xss] is a matrix (a sequence of rows), then [transpose xss] is the sequence of the columns of the matrix [xss]. The rows of the matrix [xss] are not required to have the same length. The matrix [xss] is not required to be finite (in either direction). The matrix [xss] must be persistent. @since 4.14  $:* {1 Combining sequences}  * [append xs ys] is the concatenation of the sequences [xs] and [ys]. Its elements are the elements of [xs], followed by the elements of [ys]. @since 4.11  * If [xss] is a sequence of sequences, then [concat xss] is its concatenation. If [xss] is the sequence [xs0; xs1; ...] then [concat xss] is the sequence [xs0 @ xs1 @ ...]. @since 4.13  7 8* [flat_map f xs] is equivalent to [concat (map f xs)].  y* [concat_map f xs] is equivalent to [concat (map f xs)]. [concat_map] is an alias for [flat_map]. @since 4.13  + w* [zip xs ys] is the sequence of pairs [(x, y)] drawn synchronously from the sequences [xs] and [ys]. If the sequences [xs] and [ys] have different lengths, then the sequence ends as soon as one sequence is exhausted; the excess elements in the other sequence are ignored. [zip xs ys] is equivalent to [map2 (fun a b -> (a, b)) xs ys]. @since 4.14  * [map2 f xs ys] is the sequence of the elements [f x y], where the pairs [(x, y)] are drawn synchronously from the sequences [xs] and [ys]. If the sequences [xs] and [ys] have different lengths, then the sequence ends as soon as one sequence is exhausted; the excess elements in the other sequence are ignored. [map2 f xs ys] is equivalent to [map (fun (x, y) -> f x y) (zip xs ys)]. @since 4.14  * [interleave xs ys] is the sequence that begins with the first element of [xs], continues with the first element of [ys], and so on. When one of the sequences [xs] and [ys] is exhausted, [interleave xs ys] continues with the rest of the other sequence. @since 4.14  * If the sequences [xs] and [ys] are sorted according to the total preorder [cmp], then [sorted_merge cmp xs ys] is the sorted sequence obtained by merging the sequences [xs] and [ys]. For more details on comparison functions, see {!Array.sort}. @since 4.14 頠 * [product xs ys] is the Cartesian product of the sequences [xs] and [ys]. For every element [x] of [xs] and for every element [y] of [ys], the pair [(x, y)] appears once as an element of [product xs ys]. The order in which the pairs appear is unspecified. The sequences [xs] and [ys] are not required to be finite. The sequences [xs] and [ys] must be persistent. @since 4.14 [ /* The sequence [map_product f xs ys] is the image through [f] of the Cartesian product of the sequences [xs] and [ys]. For every element [x] of [xs] and for every element [y] of [ys], the element [f x y] appears once as an element of [map_product f xs ys]. The order in which these elements appear is unspecified. The sequences [xs] and [ys] are not required to be finite. The sequences [xs] and [ys] must be persistent. [map_product f xs ys] is equivalent to [map (fun (x, y) -> f x y) (product xs ys)]. @since 4.14  .* {1 Splitting a sequence into two sequences}  * [unzip] transforms a sequence of pairs into a pair of sequences. [unzip xs] is equivalent to [(map fst xs, map snd xs)]. Querying either of the sequences returned by [unzip xs] causes [xs] to be queried. Therefore, querying both of them causes [xs] to be queried twice. Thus, [xs] must be persistent and cheap. If that is not the case, use [unzip (memoize xs)]. @since 4.14  4* [split] is an alias for [unzip]. @since 4.14  * [partition_map f xs] returns a pair of sequences [(ys, zs)], where: - [ys] is the sequence of the elements [y] such that [f x = Left y], where [x] ranges over [xs]; - [zs] is the sequence of the elements [z] such that [f x = Right z], where [x] ranges over [xs]. [partition_map f xs] is equivalent to a pair of [filter_map Either.find_left (map f xs)] and [filter_map Either.find_right (map f xs)]. Querying either of the sequences returned by [partition_map f xs] causes [xs] to be queried. Therefore, querying both of them causes [xs] to be queried twice. Thus, [xs] must be persistent and cheap. If that is not the case, use [partition_map f (memoize xs)]. @since 4.14  n* [partition p xs] returns a pair of the subsequence of the elements of [xs] that satisfy [p] and the subsequence of the elements of [xs] that do not satisfy [p]. [partition p xs] is equivalent to [filter p xs, filter (fun x -> not (p x)) xs]. Consuming both of the sequences returned by [partition p xs] causes [xs] to be consumed twice and causes the function [f] to be applied twice to each element of the list. Therefore, [f] should be pure and cheap. Furthermore, [xs] should be persistent and cheap. If that is not the case, use [partition p (memoize xs)]. @since 4.14 & 2* {1 Converting between sequences and dispensers}  s* A dispenser is a representation of a sequence as a function of type [unit -> 'a option]. Every time this function is invoked, it returns the next element of the sequence. When there are no more elements, it returns [None]. A dispenser has mutable internal state, therefore is ephemeral: the sequence that it represents can be consumed at most once.  * [of_dispenser it] is the sequence of the elements produced by the dispenser [it]. It is an ephemeral sequence: it can be consumed at most once. If a persistent sequence is needed, use [memoize (of_dispenser it)]. @since 4.14  * [to_dispenser xs] is a fresh dispenser on the sequence [xs]. This dispenser has mutable internal state, which is not protected by a lock; so, it must not be used by several threads concurrently. @since 4.14 .<* {1 Sequences of integers}  k* [ints i] is the infinite sequence of the integers beginning at [i] and counting up. @since 4.14 @?)../ocamlc0-strict-sequence(-absname"-w5+a-4-9-41-42-44-45-48"-g+-warn-error"+A*-bin-annot)-nostdlib*-principal"-o/stdlib__Seq.cmi"-c## D/builds/workspace/precheck/flambda/false/label/ocaml-linux-32/stdlib @@0VC=5{'u3########@#@@8CamlinternalFormatBasics0%FU(Q/Tu&Stdlib0Lku]8_٠.Stdlib__Either0Vy`u~c à#00nwzG&amg@0nwzG&amgAA  @yӰV L @w@@*@lΰ%t  @@!g!(@@@!!@ΐ]@@@@@@@@ @@@@@@  @WP@ Ɛ $'@ e@@ )  -Z@ D @+ 2 Q@@@@q@ ʐ D@@ ,@KS@!A!*@w1Ȑ:@7@\ɰݐZ@@АD@Os@@Ր:@ g @@B@@Xbn@  Q@.4@@M@@jM@_@א_@  }@@@P@@