Caml1999I037. $.#,Stdlib__List!t;!a@@A"[]@@(list.mlihh@@A@"::$listK@@@@@hh@@(B@@@A &@@@Y@@@@@h @@@@3@@A@&length@!a@@@@#intA@@@@@@8k9k @@MC@@/compare_lengths@7!a@@@@@B!b@@@@%@@@@@@@@[nOO\nO~@@pD@@3compare_length_with@Z!a@@@@@?@@@C@@@ @@ @@ @yu Z Zzu Z @@E@@(is_empty@x!a@ @@@ $boolE@@@@@@| i i| i @@F@@$cons@!a@@ @@@@@@@@@@@B  B  3@@G@@)singleton@!a@@@@@@@G { {G { @@H@@"hd@!a@@@@@@@L  L  @@I@@"tl@ՠ!a@@@@ޠ @@@@@@Q V VQ V q@@J@@#nth@!a@!@@@@@@@  @@"@@#@ V   V  @@K@@'nth_opt@!a@&@@@$@@@@%&optionL@@@'@@(@@)@*]  +]  @@?L@@#rev@)!a@+@@@*2 @@@,@@-@CeDe@@XM@@$init @@@@.@@$@@@/!a@1@@0R@@@2@@3@@4@chdh!@@xN@@&append @b!a@7@@@5@m @@@6r@@@8@@9@@:@nn@@O@@*rev_append @!a@=@@@;@ @@@<@@@>@@?@@@@tddtd@@P@@&concat @!a@C@@@A@@@B @@@D@@E@y  y /@@Q@@'flatten @Ġ!a@H@@@F@@@GΠ @@@I@@J@5@@R@@%equal@@!a@O@e@@@K@@L@@M@@@@N@@@@Pw@@@Q@@R@@S@@T@ @@S@@'compare@@!a@Y@@@@U@@V@@W@@@@X@@@@Z@@@[@@\@@]@@^@12@@FT@@$iter@@!a@a$unitF@@@_@@`@>@@@b @@@c@@d@@e@ST@@hU@@%iteri@@.@@@f@!a@j(@@@g@@h@@i@d@@@k3@@@l@@m@@n@yz@@V@@#map@@!a@p!b@r@@o@@@@q@@@s@@t@@u@@@W@@$mapi@@u@@@v@!a@y!b@{@@w@@x@@@@z@@@|@@}@@~@CCCu@@X@@'rev_map@@!a@!b@@@@̠@@@Ѡ@@@@@@@@,,,Z@@Y@@*filter_map@@!a@Р!b@@@@@@@@@@@@@@@@@@ @@Z@@*concat_map@@!a@ !b@@@@@@@@@@@@@@@@@@./@@C[@@-fold_left_map@@#acc@@!a@@@!b@@@@@@@@@G@@@@!@R@@@@@@@@@@@@cUUdi@@x\@@)fold_left@@#acc@@!a@ @@@@@ @r @@@@@@@@@@333r@@]@@*fold_right@@!a@@#acc@@@@@@@@@@  @@@@@@@@@^@@%iter2@@!a@@!b@x@@@@@@@@@@@@@@@@@@@@@@@@@@@_@@$map2@@!a@@!b@!c@@@@@@@@@@@@@@@@@@@@@@@@@`@@(rev_map2@@!a@@!b@!c@@@@@@@@@@@@@@@@@@@@@@@, l l- l @@Aa@@*fold_left2@@#acc@@!a@@!b@@@@@@@@@A@@@@H@@@ @@@@@@@@@Y!!Z!+!m@@nb@@+fold_right2@@!a@@!b@@#acc@@@@@@@@l@@@@s@@@@@@@@@@@@@"4"4"F"@@c@@'for_all@@!a@ @@@@@@@@@@@@@@@@@####@@d@@&exists @@!a@*@@@@@@@@@5@@@@@@@@$$$$@@e@@(for_all2!@@!a@@!b@P@@@@@@@@נ@@@@ޠ@@@b@@@@@@@@@@%%%%@@f@@'exists2"@@!a@@!b@ }@@@@@@@@@@@@ @@@ @@@ @@ @@ @@@ %&m&m!%&m&@@5g@@#mem#@!a@@% @@@@@@@@@@@:+'C'C;+'C'b@@Oh@@$memq$@!a@@? @@@@@@@@@@@T0''U0''@@ii@@$find%@@!a@@@@@@@_@@@@@@@@p9(e(eq9(e(@@j@@(find_opt&@@!a@"@@@@@ @{@@@!i@@@#@@$@@%@@)A)A@)A)t@@k@@*find_index'@@!a@(@@@&@@'@@@@)@@@*@@@+@@,@@-@H*5*5H*5*k@@l@@(find_map(@@!a@0!b@2@@@.@@/@Ơ@@@1@@@3@@4@@5@P+M+MP+M+@@m@@)find_mapi)@@@@@6@!a@:Р!b@<@@@7@@8@@9@@@@;@@@=@@>@@?@W,.,. W,.,n@@n@@&filter*@@!a@C@@@@@@A@@@@B@@@D@@E@@F@)^-)-)*^-)-X@@>o@@(find_all+@@!a@J@@@G@@H@4@@@I9@@@K@@L@@M@Jd--Kd-.)@@_p@@'filteri,@@%@@@N@!a@S@@@O@@P@@Q@[@@@R`@@@T@@U@@V@qh.].]rh.].@@q@@$take-@J@@@W@v!a@Y@@@X @@@Z@@[@@\@s/n/ns/n/@@r@@$drop.@i@@@]@!a@_@@@^ @@@`@@a@@b@}0U0U}0U0y@@s@@*take_while/@@!a@f3@@@c@@d@@@@e@@@g@@h@@i@1818181k@@t@@*drop_while0@@!a@mT@@@j@@k@۠@@@l@@@n@@o@@p@1112%@@u@@)partition1@@!a@uu@@@q@@r@@@@s@@@@v@ @@@t@@w@@x@@y@2222@@2v@@-partition_map2@@!a@|&Stdlib&Either!t!b@!c@~@@@z@@{@8@@@}@A@@@@H@@@@@@@@@@Y44Z44b@@nw@@%assoc3@!a@@^@@!b@@@@@@@@@@@y6r6rz6r6@@x@@)assoc_opt4@!a@@~@@!b@@@@@@v @@@@@@@@7777@@y@@$assq5@!a@@@@!b@@@@@@@@@@@99998@@z@@(assq_opt6@!a@@à@@!b@@@@@@ @@@@@@@@9999@@{@@)mem_assoc7@!a@@@@!b@@@@@@v@@@@@@@@:O:O:O:{@@|@@(mem_assq8@!a@@ @@!b@@@@@@@@@@@@@@+::,:;'@@@}@@,remove_assoc9@!a@@0@@!b@@@@@@?@@@@@@@@@@@@V;;W;;@@k~@@+remove_assq:@!a@@[@@!b@@@@@@j@@@@@@@@@@@@$@@A@@$sort=@@!a@@@@@@@@@@@@@@@@@@@@@????K@@ B@@+stable_sort>@@!a@@@@@@@@@@ @@@ @@@@@@@@  AA  AB!@@ 4C@@)fast_sort?@@!a@@ @@@@@@@@ ,@@@ 1@@@@@@@@ BC+C+ CC+Cb@@ WD@@)sort_uniq@@@!a@@ #@@@@@@@@ O@@@ T@@@@@@@@ eCC fCC@@ zE@@%mergeA@@!a@@ F@@@@@@@@ r@@@@ y@@@ ~@@@@@@@@@@  DD  DE @@ F@@&to_seqB@ !a@@@@u#Seq!t @@@@@@ ,FF ,FF@@ G@@&of_seqC@#Seq!t!a@@@@  @@@@@@ 1FF 1FG@@ H@@@_L,Stdlib__List0MYm 7R+Stdlib__Seq0nwzG&amg.Stdlib__Either0Vy`u~c à&Stdlib0Lku]8_٠8CamlinternalFormatBasics0%FU(Q/Tu@@@Caml1999T0376_(C,Stdlib__List*ocaml.text&_none_@@A  List operations. Some functions are flagged as not tail-recursive. A tail-recursive function uses constant stack space, while a non-tail-recursive function uses stack space proportional to the length of its list argument, which can be a problem with very long lists. When the function takes several list arguments, an approximate formula giving stack usage (in some unspecified constant unit) is shown in parentheses. The above considerations can usually be ignored if your lists are not longer than about 10000 elements. The labeled version of this module can be used as described in the {!StdLabels} module. (list.mliXf@@@@@@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+!tAhh@А!a@3@;@@@A@A@@@@@@G@B@@@hh@)ocaml.doc ! An alias for the type of lists. ii@@@@@@@@@@@@Ahh@@BA@;0@A"[]@@hh@@A@"::BB@MIB@@@@@@h4@@B@@@AXTB@@@@Y@@@@@A>@@.@#''%$@#@@@'@###hh@@А!a(ehh@@г)$listh[@А!a0thh@@@7wc@@@@1@@Aг.$list h h@А!a6hh@@@= @@vs#rq@qq@@@q@q@@@&length'k(k@б@г$list2k3k@А!a@B@3:99:::::@9@A@kAk@@@ @@@ @@г!#intNk Ok @@ @@@@@@@@@@@Yk @ ; Return the length (number of elements) of the given list. fl  gl M@@@@@@@C@@@z@@@@@@8/compare_lengths}nOS~nOb@б@г$listnOhnOl@А!a@B@3@Wr>@AnOenOg@@@ @@@ @@б@г"$listnOsnOw@А!b@B@nOpnOr@@@ @@@%@@г#intnO{nO~@@ @@@2@@@@@5@@@3@@86 @@@nOO@/ Compare the lengths of two lists. [compare_lengths l1 l2] is equivalent to [compare (length l1) (length l2)], except that the computation stops after reaching the end of the shortest list. @since 4.05 os U X@@@@@@@D@@@?@@@@@@W3compare_length_withu Z ^u Z q@б@гy$listu Z wu Z {@А!a@B@3@v>@A u Z t u Z v@@@ @@@ @@б@г#intu Z u Z @@ @@@@@г#int(u Z )u Z @@ @@@%@@@@@(@@@&@@+) @@@6u Z Z@ Compare the length of a list to an integer. [compare_length_with l len] is equivalent to [compare (length l) len], except that the computation stops after at most [len] iterations on the list. @since 4.05 Cv  Dz d g@@@@@@@\E@@@W@@@@@@J(is_emptyZ| i m[| i u@б@г᠐$liste| i {f| i @А!a@B@3mllmmmmm@i>@As| i xt| i z@@@ @@@ @@г?$bool| i | i @@ @@@@@@@@@@@| i i @퐠 [is_empty l] is true if and only if [l] has no elements. It is equivalent to [compare_length_with l 0 = 0]. @since 5.1 }  @  @@@@@@@F@@@@@@@@@8$consB  B  @б@А!a@B@3@Mh4@AB  B  @@б@гF$listB  $B  (@А!aB  !B  #@@@@@@ @@г[$listB  /B  3@А!a.)B  ,B  .@@@4@@@0 @@@@@3@@@;@@64@@@B  @V @ [cons x xs] is [x :: xs] @since 4.03 (4.05 in ListLabels) C 4 4E v y@@@@@@@G@@&@f@@@@@@U)singletonG { G { @б@А!a@B@3"!!"""""@j{4@A(G { )G { @@г$list1G { 2G { @А!a8G { 9G { @@@@@@ @@@!@@@@@DG { {@ C [singleton x] returns the one-element list [[x]]. @since 5.4 QH  RJ  @@@@@@@jH@@#@e@@@@@@;"hdhL  iL  @б@г$listsL  tL  @А!a@B@3{zz{{{{{@Zk>@AL  L  @@@ @@@ @@А!a L  L  @@@ @@@@@L  @ V Return the first element of the given list. @raise Failure if the list is empty. M  O Q T@@@@@@@I@@@@@@@@@1"tlQ V ZQ V \@б@г>$listQ V bQ V f@А!a@ B@3@Pk>@AQ V _Q V a@@@ @@@ @@гZ$listQ V mQ V q@А!aQ V jQ V l@@@"@@@ @@@@@!@@@Q V V@R [ Return the given list without its first element. @raise Failure if the list is empty. R r rT  @@@@@@@J@@#@b@@@@@@@#nthV  V  @б@г$list V  !V  @А!a@B@ 3(''(((((@_z>@A.V  /V  @@@ @@@  @@б@г#int>V  ?V  @@ @@@ @@А!a!HV  IV  @@@ &@@!@@@@@$"@@@RV   @ Return the [n]-th element of the given list. The first element (head of the list) is at position 0. @raise Failure if the list is too short. @raise Invalid_argument if [n] is negative. _W  `[  @@@@@@@xK@@@s@@@@@@C'nth_optv]  w]  @б@г$list]  ]  @А!a@B@3@b}>@A]  ]  @@@ @@@ @@б@гr#int]  ]  @@ @@@@@г &option]  ]  @А!a+&]  ]  @@@1@@@- @@@@@0@@@.@@31@@@]  @# Return the [n]-th element of the given list. The first element (head of the list) is at position 0. Return [None] if the list is too short. @raise Invalid_argument if [n] is negative. @since 4.05 ^  c@@@@@@@L@@&@3㐠@@@@@@R#revee@б@гm$listee@А!a@#B@3@q>@Aee@@@ @@@ @@г$list ee@А!aee@@@"@@@  @@@@@!!@@@ e@0 List reversal. -f.f@@@@@@@FM@@#@A@@@@@@@$init DhEh@б@г"#intOhPh@@ @@@$3QPPQQQQQ@Yt8@A@@б@б@г5#intbh ch@@ @@@%@@А!a@-B@&qhrh@@@ @@'!@@г$list}h~h!@А!a/hh@@@@@@)6 @@@@@*9h @@@@@@+=C@@@h@ [init len f] is [[f 0; f 1; ...; f (len-1)]], evaluated left to right. @raise Invalid_argument if [len < 0]. @since 4.06 i""l@@@@@@@N@@'@@@@@@@\&append!nn@б@г?$listnn@А!a@8B@.3@{>@Ann@@@ @@@0 @@б@г]$listnn@А!ann@@@$@@@2  @@гr$listnn@А!a3.nn@@@9@@@45 @@@@@58@@@6@@6;9@@@ n@m [append l0 l1] appends [l1] to [l0]. Same function as the infix operator [@]. @since 5.1 this function is tail-recursive. or_b@@@@@@@2O@@&@}-@@@@@@Z*rev_append"0tdh1tdr@б@г$list;tdx<td|@А!a@CB@93CBBCCCCC@y>@AItduJtdw@@@ @@@; @@б@гՠ$listYtdZtd@А!a`tdatd@@@$@@@=  @@гꠐ$listntdotd@А!a3.utdvtd@@@9@@@?5 @@@@@@8@@@6@@A;9@@@tdd@吠 q [rev_append l1 l2] reverses [l1] and concatenates it with [l2]. This is equivalent to [(]{!rev}[ l1) @ l2]. uw @@@@@@@P@@&@@@@@@@Z&concat#y y @б@г/$listy  y $@г9$listy y @А!a@MB@D3@H@Ay y @@@ @@@F @@@&@@@H #@@гZ$listy +y /@А!a!y (y *@@@'@@@J# @@@@@K&$@@@y  @R Concatenate a list of lists. The elements of the argument are all concatenated together (in the same order) to give the result. Not tail-recursive (length of the argument + length of the longest sub-list). z00~ @@@@@@@Q@@#@b@@@@@@E'flatten$@б@г$list &!*@г$list*!+%@А!a@WB@N321122222@nH@A89 @@@ @@@P @@@&@@@R #@@гǠ$listK1L5@А!a!R.S0@@@'@@@T# @@@@@U&$@@@^@ f Same as {!concat}. Not tail-recursive (length of the argument + length of the longest sub-list). k66l@@@@@@@R@@#@@@@@@@E0 {1 Comparison} @@@@@@3@W|1@A%equal%@б@б@А!a@eB@X@@б@А!a  @@гs$bool@@ @@@Y/@@@@@Z2@@@"@@[5 @@б@гF$list@А!a2E@@@8@@@]L @@б@г]$list@А!aI\@@@O@@@_c @@г$bool@@ @@@`p@@@@@as@@@.@@bv1 @@@F@@cy @@@ @i  [equal eq [a1; ...; an] [b1; ..; bm]] holds when the two input lists have the same length, and for each pair of elements [ai], [bi] at the same position we have [eq ai bi]. Note: the [eq] function may be called even if the lists have different length. If you know your equality function is costly, you may want to check {!compare_lengths} first. @since 4.12   @@@@@@@ .S@@"@y )@@@@@@'compare& , -@б@б@А!a@sB@f3 7 6 6 7 7 7 7 7@6@A = >@@б@А!a  E F@@г !#int N O@@ @@@g@@@!@@h@@@$@@i @@б@гߠ$list c d@А!a4/ j k@@@:@@@k6 @@б@г$list z {@А!aKF  @@@Q@@@mM @@г b#int  @@ @@@nZ@@@@@o]@@@.@@p`1 @@@F@@qc @@@ @  [compare cmp [a1; ...; an] [b1; ...; bm]] performs a lexicographic comparison of the two input lists, using the same ['a -> 'a -> int] interface as {!Stdlib.compare}: - [a1 :: l1] is smaller than [a2 :: l2] (negative result) if [a1] is smaller than [a2], or if they are equal (0 result) and [l1] is smaller than [l2] - the empty list [[]] is strictly smaller than non-empty lists Note: the [cmp] function will be called even if the lists have different lengths. @since 4.12   @@@@@@@ T@@"@ @@@@@@  ϐ/ {1 Iterators}   @@@@@@3        @1@A$iter'  @б@б@А!a@}B@t  @@г $unit  @@ @@@u'@@@@@v*@@б@г ~$list   @А!a':  @@@-@@@xA @@г Ġ$unit  @@ @@@yN@@@@@zQ@@@,@@{T # @@@ &@ } [iter f [a1; ...; an]] applies function [f] in turn to [[a1; ...; an]]. It is equivalent to [f a1; f a2; ...; f an].  3 4@@@@@@@ LU@@@ G@@@@@@t%iteri( J K@б@б@г *#int W X@@ @@@~3 Y X X Y Y Y Y Y@:@A@@б@А!a@B@  j k@@г $unit s t@@ @@@@@@@@@@@%@@"( @@б@г $list  @А!a*2  @@@0@@@9 @@г J$unit  @@ @@@F@@@@@I@@@,@@L  @@@ @ Same as {!iter}, but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument. @since 4.00   }@@@@@@@ V@@@  ͐@@@@@@l#map)  @б@б@А!a@B@3        @6@A  @@А!b@B@   @@@ @@@@б@г v$list  @А!a'"  @@@-@@@) @@г $list  @А!b/7  @@@5@@@> @@@@@A@@@4@@D #@@@ &@ [map f [a1; ...; an]] applies function [f] to [a1, ..., an], and builds the list [[f a1; ...; f an]] with the results returned by [f].  3 4>A@@@@@@@ LW@@'@  G@@@@@@d$mapi* JCG KCK@б@б@г *#int WCO XCR@@ @@@3 Y X X Y Y Y Y Y@:@A@@б@А!a@B@  jCV kCX@@А!b@B@ uC\ vC^@@@ @@@@@#@@ &@@б@г $list Cf Cj@А!a(0 Cc Ce@@@.@@@7 @@г $list Cq Cu@А!b2E Cn Cp@@@8@@@L @@@@@O@@@4@@R CN@@@ CC@  Same as {!map}, but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument. @since 4.00  vv '*@@@@@@@ X@@'@ # Ӑ@@@@@@r'rev_map+ ,0 ,7@б@б@А!a@B@3        @6@A ,; ,=@@А!b@B@  ,A ,C@@@ @@@@б@г |$list ,K ,O@А!a'" ,H ,J@@@-@@@) @@г $list ,V ,Z@А!b/7 ,S ,U@@@5@@@> @@@@@A@@@4@@D ),:@@@ ,,,@ \ [rev_map f l] gives the same result as {!rev}[ (]{!map}[ f l)], but is more efficient.  9[[ :@@@@@@@ RY@@'@  M@@@@@@d*filter_map, P Q@б@б@А!a@B@3 [ Z Z [ [ [ [ [@{6@A a b@@г ɠ&option j k@А!b@B@ v w@@@ @@@@@@&@@!@@б@г $list  @А!a61  @@@<@@@8 @@г $list  @А!b4F  @@@:@@@M @@@@@P@@@4@@S @@@ @  [filter_map f l] applies [f] to every element of [l], filters out the [None] elements and returns the list of the arguments of the [Some] elements. @since 4.08   @@@@@@@ Z@@'@ & ֐@@@@@@s*concat_map-  @б@б@А!a@B@3        @6@A  @@г o$list  @А!b@B@  @@@ @@@@@@&@@!@@б@г $list  @А!a61  @@@<@@@8 @@г $list ' (@А!b4F . /@@@:@@@M @@@@@P@@@4@@S ;@@@ >@ k [concat_map f l] gives the same result as {!concat}[ (]{!map}[ f l)]. Tail-recursive. @since 4.10  K LQS@@@@@@@ d[@@'@  _@@@@@@s-fold_left_map. bUY cUf@б@б@А#acc@B@3 m l l m m m m m@6@A sil tip@@б@А!a@B@ it iv@@В@А#acc iz i~@@@А!b@B@& i i@@@@2@@@/@@@( @@2# @@@:@@53@@б@А#acc@; i i@@б@г 3$list i i@А!aCM i i@@@I@@@T @@В@А#acca\ i i@@@г T$list i i@А!bMn i i@@@S@@@u @@@@@ @@| @@@/ @@2@@@@@G@@@R@@ ik@@@ UU!@ Z [fold_left_map] is a combination of [fold_left] and [map] that threads an accumulator through calls to [f]. @since 4.11 /1@@@@@@@\@@1@ j@@@@@@)fold_left/373@@б@б@А#acc@B@3(''(((((@6@A.3D/3H@@б@А!a@B@;3L<3N@@А#accA3RB3V@@@@@ @@@"@@@@б@А#acc(#O3[P3_@@б@г ֠$listZ3f[3j@А!a+5a3cb3e@@@1@@@< @@А#accE@l3nm3r@@@ J@@E@@@M@@H%@@@0@@Kw3C @@@z33@ ې N [fold_left f init [b1; ...; bn]] is [f (... (f (f init b1) b2) ...) bn]. ss@@@@@@@]@@@ @@@@@@k*fold_right0@б@б@А!a@B@3@6@A@@б@А#acc@B@@@А#acc @@@@@ @@@"@@@@б@гO$list@А!a2-@@@8@@@4 @@б@А#acc0:@@А#acc6@@@@;;@@E @@@@@H@@@0@@K @@@@ \ c [fold_right f [a1; ...; an] init] is [f a1 (f a2 (... (f an init) ...))]. Not tail-recursive.    nq@@@@@@@!^@@@ l@@@@@@k*)< {1 Iterators on two lists} &tt't@@@@@@3%$$%%%%%@}1@A%iter2123@б@б@А!a@ B@AB@@б@А!b@B@%NO@@г$unitWX@@ @@@4@@@@@7@@@'@@:" @@б@г蠐$listlm@А!a7Jst@@@=@@@Q @@б@г$list@А!bAa@@@G@@@h @@гE$unit@@ @@@u@@@@@ x@@@.@@ {1 @@@F@@ ~@@@@ [iter2 f [a1; ...; an] [b1; ...; bn]] calls in turn [f a1 b1; ...; f an bn]. @raise Invalid_argument if the two lists are determined to have different lengths. @@@@@@@_@@"@ː@@@@@@$map22@б@б@А!a@B@3@6@A@@б@А!b@!B@@@А!c@#B@@@@ @@@@@'@@" @@б@г$list @А!a72@@@=@@@9 @@б@г$list @А!b?I&'@@@E@@@P @@г$list45@А!cI^;<@@@O@@@e @@@@@h@@@6@@k9@@@N@@nK@@@N@ [map2 f [a1; ...; an] [b1; ...; bn]] is [[f a1 b1; ...; f an bn]]. @raise Invalid_argument if the two lists are determined to have different lengths. [\ g j@@@@@@@t`@@*@o@@@@@@(rev_map23r l ps l x@б@б@А!a@3B@$3}||}}}}}@6@A l | l ~@@б@А!b@5B@% l  l @@А!c@7B@& l  l @@@ @@'@@@'@@(" @@б@г($list l  l @А!a72 l  l @@@=@@@*9 @@б@г?$list l  l @А!b?I l  l @@@E@@@,P @@гT$list l  l @А!cI^ l  l @@@O@@@.e @@@@@/h@@@6@@0k9@@@N@@1n l {@@@ l l@S f [rev_map2 f l1 l2] gives the same result as {!rev}[ (]{!map2}[ f l1 l2)], but is more efficient.   !!@@@@@@@a@@*@c@@@@@@*fold_left24!!!!(@б@б@А#acc@IB@83!  !!!!!@6@A'!+!.(!+!2@@б@А!a@GB@94!+!65!+!8@@б@А!b@KB@:A!+!<B!+!>@@А#acc'"G!+!BH!+!F@@@,@@;' @@@ @@<*@@@2@@=-+ @@б@А#acc83X!+!KY!+!O@@б@гߠ$listc!+!Vd!+!Z@А!a;Ej!+!Sk!+!U@@@A@@@?L @@б@г$listz!+!a{!+!e@А!bE\!+!^!+!`@@@K@@@Ac @@А#acclg!+!i!+!m@@@ q@@Bl@@@'@@Co*@@@w@@Dr? @@@J@@Eu!+!-@@@!!@ [fold_left2 f init [a1; ...; an] [b1; ...; bn]] is [f (... (f (f init a1 b1) a2 b2) ...) an bn]. @raise Invalid_argument if the two lists are determined to have different lengths. !n!n"/"2@@@@@@@b@@!@@@@@@@+fold_right25"4"8"4"C@б@б@А!a@[B@L3@6@A"F"I"F"K@@б@А!b@_B@M"F"O"F"Q@@б@А#acc@]B@N"F"U"F"Y@@А#acc ""F"]"F"a@@@@@O' @@@ @@P*@@@2@@Q-+ @@б@г$list"F"i"F"m@А!aB= "F"f"F"h@@@H@@@SD @@б@г$list"F"t"F"x@А!bJT$"F"q%"F"s@@@P@@@U[ @@б@А#accJa1"F"|2"F"@@А#accPg7"F"8"F"@@@UU@@Vl @@@@@Wo@@@2@@Xr5 @@@J@@YuE"F"H@@@H"4"4@ [fold_right2 f [a1; ...; an] [b1; ...; bn] init] is [f a1 b1 (f a2 b2 (... (f an bn init) ...))]. @raise Invalid_argument if the two lists are determined to have different lengths. Not tail-recursive. U""V #_#b@@@@@@@nc@@!@i@@@@@@wv3 {1 List scanning} s#e#et#e#}@@@@@@3rqqrrrrr@1@A'for_all6####@б@б@А!a@iB@`####@@гU$bool####@@ @@@a'@@@@@b*@@б@г%$list####@А!a':####@@@-@@@dA @@г|$bool####@@ @@@eN@@@@@fQ@@@,@@gT## @@@##@. [for_all f [a1; ...; an]] checks if all elements of the list satisfy the predicate [f]. That is, it returns [(f a1) && (f a2) && ... && (f an)] for a non-empty list and [true] if the list is empty. ##$$@@@@@@@d@@@>@@@@@@t&exists7$$$$@б@б@А!a@sB@j3@6@A$$$$@@гɠ$bool $$ $$@@ @@@k@@@@@l@@б@г$list$$$$@А!a)$$$$%$$@@@/@@@n+ @@г$bool2$$3$$@@ @@@o8@@@@@p;@@@,@@q>>$$ @@@A$$@ [exists f [a1; ...; an]] checks if at least one element of the list satisfies the predicate [f]. That is, it returns [(f a1) || (f a2) || ... || (f an)] for a non-empty list and [false] if the list is empty. N$$O%%@@@@@@@ge@@@b@@@@@@^(for_all28e%%f%%@б@б@А!a@B@t3pooppppp@u6@Av%%w%%@@б@А!b@B@u%%%%@@гJ$bool%%%%@@ @@@v@@@@@w!@@@)@@x$" @@б@г$list%%%%@А!a94%%%%@@@?@@@z; @@б@г4$list%%%%@А!bAK%%%%@@@G@@@|R @@г$bool%%%%@@ @@@}_@@@@@~b@@@.@@e1 @@@F@@h%%@@@%%@@ Same as {!for_all}, but for a two-argument predicate. @raise Invalid_argument if the two lists are determined to have different lengths.  %%#&h&k@@@@@@@f@@"@P@@@@@@'exists29%&m&q%&m&x@б@б@А!a@B@3  @6@A%&m&|%&m&~@@б@А!b@B@!%&m&"%&m&@@г蠐$bool*%&m&+%&m&@@ @@@@@@@@!@@@)@@$" @@б@г$list?%&m&@%&m&@А!a94F%&m&G%&m&@@@?@@@; @@б@гҠ$listV%&m&W%&m&@А!bAK]%&m&^%&m&@@@G@@@R @@г)$boolk%&m&l%&m&@@ @@@_@@@@@b@@@.@@e1 @@@F@@hz%&m&{@@@}%&m&m@ސ Same as {!exists}, but for a two-argument predicate. @raise Invalid_argument if the two lists are determined to have different lengths. &&&)'>'A@@@@@@@g@@"@@@@@@@#mem:+'C'G+'C'J@б@А!a@B@3@4@A+'C'M+'C'O@@б@г7$list+'C'V+'C'Z@А!a+'C'S+'C'U@@@@@@ @@г$bool+'C'^+'C'b@@ @@@(@@@@@+@@@3@@., @@@+'C'C@? M [mem a set] is true if and only if [a] is equal to an element of [set]. ,'c'c.''@@@@@@@h@@@O@@@@@@M$memq;0''0''@б@А!a@B@3        @bs4@A0''0''@@б@г$list0''0''@А!a#0''$0''@@@@@@ @@г$bool10''20''@@ @@@(@@@@@+@@@3@@., @@@?0''@ i Same as {!mem}, but uses physical equality instead of structural equality to compare list elements. L1''M3(C(F@@@@@@@ei@@@`@@@@@@Mnm4 {1 List searching} j6(I(Ik6(I(b@@@@@@3ihhiiiii@_p1@A$find<v9(e(iw9(e(m@б@б@А!a@B@9(e(q9(e(s@@гL$bool9(e(w9(e({@@ @@@'@@@@@*@@б@г$list9(e(9(e(@А!a':9(e(9(e(@@@-@@@A @@А!a2E9(e(9(e(@@@ 7@@J@@@%@@M9(e(p@@@9(e(e @ [find f l] returns the first element of the list [l] that satisfies the predicate [f]. @raise Not_found if there is no value that satisfies [f] in the list [l]. :((>)<)?@@@@@@@j@@@.ސ@@@@@@m(find_opt=@)A)E@)A)M@б@б@А!a@B@3@6@A@)A)Q@)A)S@@г$bool@)A)W@)A)[@@ @@@@@@@@@@б@г$list @)A)c@)A)g@А!a)$@)A)`@)A)b@@@/@@@+ @@г&option"@)A)n#@)A)t@А!a>9)@)A)k*@)A)m@@@D@@@@ @@@@@C@@@4@@F6@)A)P@@@9@)A)A@ [find f l] returns the first element of the list [l] that satisfies the predicate [f]. Returns [None] if there is no value that satisfies [f] in the list [l]. @since 4.05 FA)u)uGF*0*3@@@@@@@_k@@'@Z@@@@@@f*find_index>]H*5*9^H*5*C@б@б@А!a@B@3hgghhhhh@}6@AnH*5*GoH*5*I@@г5$boolwH*5*MxH*5*Q@@ @@@@@@@@@@б@г$listH*5*YH*5*]@А!a)$H*5*VH*5*X@@@/@@@+ @@г&optionH*5*eH*5*k@г{#intH*5*aH*5*d@@ @@@B@@@@@@G @@@#@@J&@@@;@@MH*5*F@@@H*5*5@ [find_index f xs] returns [Some i], where [i] is the index of the first element of the list [xs] that satisfies [f x], if there is such an element. It returns [None] if there is no such element. @since 5.1 I*l*lN+;+K@@@@@@@l@@.@-ݐ@@@@@@m(find_map?P+M+QP+M+Y@б@б@А!a@B@3@6@AP+M+]P+M+_@@гY&optionP+M+fP+M+l@А!b@B@P+M+cP+M+e@@@ @@@@@@&@@!@@б@г$listP+M+tP+M+x@А!a61 P+M+q!P+M+s@@@<@@@8 @@г&option.P+M+/P+M+@А!b4F5P+M+|6P+M+~@@@:@@@M @@@@@P@@@4@@SBP+M+\@@@EP+M+M@ [find_map f l] applies [f] to the elements of [l] in order, and returns the first result of the form [Some v], or [None] if none exist. @since 4.10 RQ++SU,*,,@@@@@@@km@@'@f@@@@@@s)find_mapi@iW,.,2jW,.,;@б@б@гI#intvW,.,?wW,.,B@@ @@@3xwwxxxxx@:@A@@б@А!a@B@ W,.,FW,.,H@@г&optionW,.,OW,.,U@А!b@B@"W,.,LW,.,N@@@ @@@)@@@$@@,@@@2@@/5@@б@г0$listW,.,]W,.,a@А!a7?W,.,ZW,.,\@@@=@@@F @@г(&optionW,.,hW,.,n@А!b7TW,.,eW,.,g@@@=@@@[ @@@@@^@@@4@@aW,.,>@@@W,.,.@A 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. @since 5.1 X,o,o\--'@@@@@@@n@@'@Q@@@@@@&filterA^-)--^-)-3@б@б@А!a@B@3@6@A^-)-7^-)-9@@гܠ$bool^-)-=^-)-A@@ @@@@@@@@@@б@г$list0^-)-I1^-)-M@А!a)$7^-)-F8^-)-H@@@/@@@+ @@г$listE^-)-TF^-)-X@А!a>9L^-)-QM^-)-S@@@D@@@@ @@@@@C@@@4@@FY^-)-6@@@\^-)-)@ [filter f l] returns all the elements of the list [l] that satisfy the predicate [f]. The order of the elements in the input list is preserved. i_-Y-Yjb--@@@@@@@o@@'@}@@@@@@f(find_allBd--d-.@б@б@А!a@B@3@}6@Ad-.d-. @@гX$boold-.d-.@@ @@@@@@@@@@б@г($listd-.d-.@А!a)$d-.d-.@@@/@@@+ @@г=$listd-.%d-.)@А!a>9d-."d-.$@@@D@@@@ @@@@@C@@@4@@Fd-.@@@d--@9 , [find_all] is another name for {!filter}. e.*.*f.X.[@@@@@@@p@@'@I@@@@@@f'filteriCh.].ah.].h@б@б@гܠ#int h.].l h.].o@@ @@@3        @:@A@@б@А!a@B@ h.].sh.].u@@г㠐$bool%h.].y&h.].}@@ @@@@@@@@@@@%@@"( @@б@г$list:h.].;h.].@А!a*2Ah.].Bh.].@@@0@@@9 @@гˠ$listOh.].Ph.].@А!a?GVh.].Wh.].@@@E@@@N @@@@@Q@@@4@@Tch.].k@@@fh.].]@ǐ 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 4.11 si..tm/J/L@@@@@@@q@@'@@@@@@@t7 {1 List manipulation} p/O/Op/O/k@@@@@@3@1@A$takeDs/n/rs/n/v@б@г{#ints/n/ys/n/|@@ @@@ @@б@г3$lists/n/s/n/@А!a@B@ /s/n/s/n/@@@ @@@ 6@@гM$lists/n/s/n/@А!aDs/n/s/n/@@@ @@@K @@@@@N@@@:@@Q=@@@s/n/n@H [take n l] returns the prefix of [l] of length [n], or a copy of [l] if [n > length l]. [n] must be nonnegative. @raise Invalid_argument if [n] is negative. @since 5.3 t//{0Q0S@@@@@@@ r@@&@X@@@@@@p$dropE }0U0Y }0U0]@б@г預#int}0U0`}0U0c@@ @@@3@8@A@@б@г$list'}0U0j(}0U0n@А!a@B@3}0U0g4}0U0i@@@ @@@@@г$listA}0U0uB}0U0y@А!a,H}0U0rI}0U0t@@@ @@@3 @@@@@6@@@<@@9?@@@W}0U0U@ [drop n l] returns the suffix of [l] after [n] elements, or [[]] if [n > length l]. [n] must be nonnegative. @raise Invalid_argument if [n] is negative. @since 5.3 d~0z0ze1416@@@@@@@}s@@&@x@@@@@@X*take_whileF{181<|181F@б@б@А!a@'B@3@o6@A181J181L@@гS$bool181P181T@@ @@@@@@@@@@б@г#$list181\181`@А!a)$181Y181[@@@/@@@!+ @@г8$list181g181k@А!a>9181d181f@@@D@@@#@ @@@@@$C@@@4@@%F181I@@@1818@4  [take_while p l] is the longest (possibly empty) prefix of [l] containing only elements that satisfy [p]. @since 5.3 1l1l11@@@@@@@t@@'@D@@@@@@f*drop_whileG1112@б@б@А!a@2B@(3@}6@A12 12@@гϠ$bool12 12@@ @@@)@@@@@*@@б@г$list#12$12@А!a)$*12+12@@@/@@@,+ @@г$list812!912%@А!a>9?12@12 @@@D@@@.@ @@@@@/C@@@4@@0FL12@@@O11@ [drop_while p l] is the longest (possibly empty) suffix of [l] starting at the first element that does not satisfy [p]. @since 5.3 \2&2&]22@@@@@@@uu@@'@p@@@@@@f)partitionHs22t22@б@б@А!a@@B@33~}}~~~~~@}6@A2222@@гK$bool2222@@ @@@4@@@@@5@@б@г$list2222@А!a)$2222@@@/@@@7+ @@В@г4$list2222@А!aB=2222@@@H@@@9D @@@гK$list2222@А!aYT2222@@@_@@@;[ @@@@ @ @@<b%@@@> @@=eA@@@V@@>h22@@@22@N  [partition f l] returns a pair of lists [(l1, l2)], where [l1] is the list of all the elements of [l] that satisfy the predicate [f], and [l2] is the list of all the elements of [l] that do not satisfy [f]. The order of the elements in the input list is preserved. 2244@@@@@@@v@@.@^@@@@@@-partition_map[4444&@б@б@А!a@ /B@A3@6@A"44*#44,@@г&Either!t/449044?@ 344@444A@@А!b@ 1B@  @441A443@@А!c@ 3B@ ,L445M447@@@* @@@ #4T440!@@@= @@ $86$@@б@гݠ$lista44Ib44M@А!aMHh44Fi44H@@@S@@@ &O @@В@г$listz44T{44X@А!bFa44Q44S@@@L@@@ (h @@@г $list44^44b@А!cQx44[44]@@@W@@@ * @@@@ @ @@ +%@@@> @@ ,A@@@V@@ -44)@@@44@  [partition_map f l] returns a pair of lists [(l1, l2)] such that, for each element [x] of the input list [l]: - if [f x] is [Left y1], then [y1] is in [l1], and - if [f x] is [Right y2], then [y2] is in [l2]. The output elements are included in [l1] and [l2] in the same relative order as the corresponding input elements in [l]. In particular, [partition_map (fun x -> if f x then Left x else Right x) l] is equivalent to [partition f l]. @since 4.12 4c4c6N6P@@@@@@@w@@.@ А@@@@@@ݐ7 {1 Association lists} 6S6S6S6o@@@@@@3@1@A%assoc\6r6v6r6{@б@А!a@ B@ 596r66r6@@@@/@@@ 6B@@@( @@@ 8G$6r6&@@А!bL)6r6*6r6@@@@@ 9Q @@@C@@ :T>@@@36r6r @  [assoc a l] returns the value associated with key [a] in the list of pairs [l]. That is, [assoc a [ ...; (a,b); ...] = b] if [(a,b)] is the leftmost binding of [a] in list [l]. @raise Not_found if there is no value associated with [a] in the list [l]. @66A77@@@@@@@Yx@@@T@@@@@@s)assoc_opt]W77X77@б@А!a@ IB@ ?3`__`````@4@Af77g77@@б@г$listq77r77@В@А!a|77}77@@@А!b@ KB@ @%7777@@@@1@@@ A.@@@( @@@ C377&@@г&option7777@А!b"B7777@@@(@@@ EI @@@@@ FL@@@T@@ GOM@@@77@ - [assoc_opt a l] returns the value associated with key [a] in the list of pairs [l]. That is, [assoc_opt a [ ...; (a,b); ...] = Some b] if [(a,b)] is the leftmost binding of [a] in list [l]. Returns [None] if there is no value associated with [a] in the list [l]. @since 4.05 7799@@@@@@@y@@&@&֐@@@@@@n$assq^9999@б@А!a@ TB@ L3@4@A9999 @@б@гo$list99.992@В@А!a99%99'@@@А!b@ VB@ M% 99* 99,@@@@1@@@ N.@@@( @@@ P399$&@@А!b8996998@@@@@ Q= @@@E@@ R@>@@@(99 @ b Same as {!assoc}, but uses physical equality instead of structural equality to compare keys. 59999699@@@@@@@Nz@@@I@@@@@@_(assq_opt_L99M99@б@А!a@ aB@ W3UTTUUUUU@t4@A[99\99@@б@г⠐$listf99g99@В@А!aq99r99@@@А!b@ cB@ X%~9999@@@@1@@@ Y.@@@( @@@ [399&@@г&option9999@А!b"B9999@@@(@@@ ]I @@@@@ ^L@@@T@@ _OM@@@99@ u Same as {!assoc_opt}, but uses physical equality instead of structural equality to compare keys. @since 4.05 99:J:M@@@@@@@{@@&@ː@@@@@@n)mem_assoc`:O:S:O:\@б@А!a@ mB@ d3@4@A:O:_:O:a@@б@гd$list:O:o:O:s@В@А!a:O:f:O:h@@@А!b@ oB@ e%:O:k:O:m@@@@1@@@ f.@@@( @@@ h3:O:e&@@гԠ$bool:O:w:O:{@@ @@@ iA@@@@@ jD@@@L@@ kGE @@@$:O:O@ y Same as {!assoc}, but simply return [true] if a binding exists, and [false] if no bindings exist for the given key. 1:|:|2::@@@@@@@J|@@@E@@@@@@f(mem_assqaH:;I:;@б@А!a@ yB@ p3QPPQQQQQ@{4@AW:; X:; @@б@гޠ$listb:;c:;@В@А!am:;n:;@@@А!b@ {B@ q%z:;{:;@@@@1@@@ r.@@@( @@@ t3:;&@@гN$bool:;#:;'@@ @@@ uA@@@@@ vD@@@L@@ wGE @@@::@ f Same as {!mem_assoc}, but uses physical equality instead of structural equality to compare keys. ;(;(;;@@@@@@@}@@@@@@@@@f,remove_assocb;;;;@б@А!a@ B@ |3@{4@A;;;;@@б@гX$list;;;;@В@А!a;;;;@@@А!b@ B@ }%;;;;@@@@1@@@ ~.@@@( @@@ 3 ;;&@@г$list ;; ;;@В@А!aKF ;; ;;@@@А!b.N ;; ;;@@@@Z@7@@ W@@@# @@@ \ +;;!@@@1@@ `-$@@@h@@ ca'@@@ 4;;*@ z [remove_assoc a l] returns the list of pairs [l] without the first pair with key [a], if any. Not tail-recursive.  A;; B@@@@@@@ :@@@- @@@ ?!7=*=6+@@В@г $list!C=*=K!D=*=O@А!a3R!J=*=H!K=*=J@@@9@@@ Y @@@г ֠$list!Z=*=U![=*=Y@А!b=i!a=*=R!b=*=T@@@C@@@ p @@@@ @ @@ w%@@@? @@ z;@@@!t=*=*@Ր Transform a list of pairs into a pair of lists: [split [(a1,b1); ...; (an,bn)]] is [([a1; ...; an], [b1; ...; bn])]. Not tail-recursive. !=Z=Z!==@@@@@@@!@@@*@!@@@@@@'combinee!==!==@б@г!$list!=>!=>@А!a@ B@ 3!!!!!!!!@>@A!=>!=>@@@ @@@  @@б@г!=$list!=>!=>@А!b@ B@ !=> !=> @@@ @@@ %@@г!W$list!=> !=>$@В@А!a<7!=>!=>@@@А!b&?!=>!=>@@@@K@/@@ H@@@# @@@ M!=>!@@@0@@ Q3$@@@O@@ TR'@@@"==*@ f Transform a pair of lists into a list of pairs: [combine [a1; ...; an] [b1; ...; bn]] is [[(a1,b1); ...; (an,bn)]]. @raise Invalid_argument if the two lists have different lengths. Not tail-recursive. ">%>%">?@@@@@@@"+A@@:@ v"&@@@@@@s"4"3- {1 Sorting} "0??"1??@@@@@@3"/"."."/"/"/"/"/@1@A$sortf"<??"=??!@б@б@А!a@ B@ "K??%"L??'@@б@А!a  "S??+"T??-@@г"/#int"\??1"]??4@@ @@@ /@@@@@ 2@@@"@@ 5 @@б@г!$list"q??<"r??@@А!a2E"x??9"y??;@@@8@@@ L @@г"$list"??G"??K@А!aGZ"??D"??F@@@M@@@ a @@@@@ d@@@4@@ g"??$@@@"??@  Sort a list in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see Array.sort for a complete specification). For example, {!Stdlib.compare} is a suitable comparison function. The resulting list is sorted in increasing order. {!sort} is guaranteed to run in constant heap space (in addition to the size of the result list) and logarithmic stack space. The current implementation uses Merge Sort. It runs in constant heap space and logarithmic stack space. "?L?L"AA@@@@@@@"B@@'@!"@@@@@@+stable_sortg" AA" AA@б@б@А!a@ B@ 3""""""""@6@A" AA" AA@@б@А!a " AB" AB@@г"#int" AB" AB @@ @@@ @@@!@@ @@@$@@  @@б@г"t$list" AB" AB@А!a4/" AB# AB@@@:@@@ 6 @@г"$list#  AB# AB!@А!aID# AB# AB@@@O@@@ K @@@@@ N@@@4@@ Q#! AA@@@#$ AA@!  Same as {!sort}, but the sorting algorithm is guaranteed to be stable (i.e. elements that compare equal are kept in their original order). The current implementation uses Merge Sort. It runs in constant heap space and logarithmic stack space. #1 B"B"#2C&C)@@@@@@@#JC@@'@!#E@@@@@@q)fast_sorth#HC+C/#IC+C8@б@б@А!a@ B@ 3#S#R#R#S#S#S#S#S@6@A#YC+C<#ZC+C>@@б@А!a #aC+CB#bC+CD@@г#=#int#jC+CH#kC+CK@@ @@@ @@@!@@ @@@$@@  @@б@г"$list#C+CS#C+CW@А!a4/#C+CP#C+CR@@@:@@@ 6 @@г#$list#C+C^#C+Cb@А!aID#C+C[#C+C]@@@O@@@ K @@@@@ N@@@4@@ Q#C+C;@@@#C+C+@" O Same as {!sort} or {!stable_sort}, whichever is faster on typical input. #CcCc#CC@@@@@@@#D@@'@"#̐@@@@@@q)sort_uniqi#CC#CC@б@б@А!a@ B@ 3########@6@A#CC#CC@@б@А!a #CC#CC@@г#Ġ#int#CC#CC@@ @@@ @@@!@@ @@@$@@  @@б@г#$list$CC$CC@А!a4/$ CC$CC@@@:@@@ 6 @@г#$list$CC$CC@А!aID$"CC$#CC@@@O@@@ K @@@@@ N@@@4@@ Q$/CC@@@$2CC@" Same as {!sort}, but also remove duplicates: if multiple elements compare equal, keep only the first. @since 4.02 (4.03 in ListLabels) @before 5.4 the element kept was not necessarily the first one. $?CC$@DD@@@@@@@$XE@@'@"$S@@@@@@q%mergej$V DD$W DD@б@б@А!a@ B@ 3$a$`$`$a$a$a$a$a@6@A$g DD$h DD@@б@А!a $o DD$p DD@@г$K#int$x DD$y DD@@ @@@ @@@!@@ @@@$@@  @@б@г$ $list$ DD$ DD@А!a4/$ DD$ DD@@@:@@@ 6 @@б@г$ $list$ DD$ DE@А!aKF$ DD$ DD@@@Q@@@ M @@г$5$list$ DE $ DE @А!a`[$ DE$ DE@@@f@@@ b @@@@@ e@@@6@@ h9@@@N@@ k$ DD@@@$ DD@#4 o Merge two lists: Assuming that [l1] and [l2] are sorted according to the comparison function [cmp], [merge cmp l1 l2] will return a sorted list containing all the elements of [l1] and [l2]. If several elements compare equal, the elements of [l1] will be before the elements of [l2]. Not tail-recursive (sum of the lengths of the arguments). $!EE$(FF@@@@@@@$F@@*@#D$@@@@@@%%9 {1 Lists and Sequences} $*FF$*FF@@@@@@3$$$$$$$$@1@A&to_seq% ,FF% ,FF@б@г$$list%,FF%,FF@А!a@ B@  %!,FF%",FF@@@ @@@ '@@г##Seq!t%3,FF%4,FF@ %7,FF%8,FF@@А!a#>%?,FF%@,FF@@@)@@@ E@@@%@@ H(@@@%K,FF@# ' Iterate on the list. @since 4.07 %X-FF%Y/FF@@@@@@@%qG@@$@#%l@@@@@@g&of_seq%o1FF%p1FF@б@г$#Seq!t%~1FG%1FG@ %1FG%1FG@@А!a@ 'B@ 3%%%%%%%%@G@A%1FG%1FG@@@  @@@ " @@г%$list%1FG%1FG@А!a%1FG %1FG@@@"@@@ $ @@@@@ %!@@@%1FF@$ 1 Create a list from a sequence. @since 4.07 %2GG%4GGGJ@@@@@@@%H@@#@$#%Ӑ@@@@@@@@$T$A@##{@#[#@""@""N@".!@!!@!z!M@!- @  @ r $@ @V@6@j@J@@a@U@"@N@.@L@,@M@-@ @@n@b@B@@u@U@I@)@;@@@@ @e@E@j@J@J@* @  V@ 6 @  K@ + @  c@ C @  M@ - @ Z @@k@@z"@@@@O@K@@0@@&@@T@@@3&Y&X&X&Y&Y&Y&Y&Y@@A@ H************************************************************************&bA@@&cA@L@ H &hBMM&iBM@ H OCaml &nC&oC@ H &tD&uD3@ H Xavier Leroy, projet Cristal, INRIA Rocquencourt &zE44&{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 &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@ NOTE: If this file is listLabels.mli, run tools/sync_stdlib_docs after editing it to generate list.mli. If this file is list.mli, do not edit it directly -- edit listLabels.mli instead. &P77&V@ * List operations. Some functions are flagged as not tail-recursive. A tail-recursive function uses constant stack space, while a non-tail-recursive function uses stack space proportional to the length of its list argument, which can be a problem with very long lists. When the function takes several list arguments, an approximate formula giving stack usage (in some unspecified constant unit) is shown in parentheses. The above considerations can usually be ignored if your lists are not longer than about 10000 elements. The labeled version of this module can be used as described in the {!StdLabels} module. &!*&h&h@ "* An alias for the type of lists. % <* Return the length (number of elements) of the given list. $b * Compare the lengths of two lists. [compare_lengths l1 l2] is equivalent to [compare (length l1) (length l2)], except that the computation stops after reaching the end of the shortest list. @since 4.05 # * Compare the length of a list to an integer. [compare_length_with l len] is equivalent to [compare (length l) len], except that the computation stops after at most [len] iterations on the list. @since 4.05 # * [is_empty l] is true if and only if [l] has no elements. It is equivalent to [compare_length_with l 0 = 0]. @since 5.1 #8 A* [cons x xs] is [x :: xs] @since 4.03 (4.05 in ListLabels) "Ҡ D* [singleton x] returns the one-element list [[x]]. @since 5.4 " W* Return the first element of the given list. @raise Failure if the list is empty. ": \* Return the given list without its first element. @raise Failure if the list is empty. !ߠ * Return the [n]-th element of the given list. The first element (head of the list) is at position 0. @raise Failure if the list is too short. @raise Invalid_argument if [n] is negative. ! * Return the [n]-th element of the given list. The first element (head of the list) is at position 0. Return [None] if the list is too short. @raise Invalid_argument if [n] is negative. @since 4.05 !1* List reversal.  * [init len f] is [[f 0; f 1; ...; f (len-1)]], evaluated left to right. @raise Invalid_argument if [len < 0]. @since 4.06  H * [append l0 l1] appends [l1] to [l0]. Same function as the infix operator [@]. @since 5.1 this function is tail-recursive. Ӡ r* [rev_append l1 l2] reverses [l1] and concatenates it with [l2]. This is equivalent to [(]{!rev}[ l1) @ l2]. ^ * Concatenate a list of lists. The elements of the argument are all concatenated together (in the same order) to give the result. Not tail-recursive (length of the argument + length of the longest sub-list).  g* Same as {!concat}. Not tail-recursive (length of the argument + length of the longest sub-list). 1* {1 Comparison} o * [equal eq [a1; ...; an] [b1; ..; bm]] holds when the two input lists have the same length, and for each pair of elements [ai], [bi] at the same position we have [eq ai bi]. Note: the [eq] function may be called even if the lists have different length. If you know your equality function is costly, you may want to check {!compare_lengths} first. @since 4.12 栠 * [compare cmp [a1; ...; an] [b1; ...; bm]] performs a lexicographic comparison of the two input lists, using the same ['a -> 'a -> int] interface as {!Stdlib.compare}: - [a1 :: l1] is smaller than [a2 :: l2] (negative result) if [a1] is smaller than [a2], or if they are equal (0 result) and [l1] is smaller than [l2] - the empty list [[]] is strictly smaller than non-empty lists Note: the [cmp] function will be called even if the lists have different lengths. @since 4.12 P0* {1 Iterators} 5 ~* [iter f [a1; ...; an]] applies function [f] in turn to [[a1; ...; an]]. It is equivalent to [f a1; f a2; ...; f an]. Ѡ * Same as {!iter}, but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument. @since 4.00 N * [map f [a1; ...; an]] applies function [f] to [a1, ..., an], and builds the list [[f a1; ...; f an]] with the results returned by [f]. נ * Same as {!map}, but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument. @since 4.00 N ]* [rev_map f l] gives the same result as {!rev}[ (]{!map}[ f l)], but is more efficient. נ * [filter_map f l] applies [f] to every element of [l], filters out the [None] elements and returns the list of the arguments of the [Some] elements. @since 4.08 Q l* [concat_map f l] gives the same result as {!concat}[ (]{!map}[ f l)]. Tail-recursive. @since 4.10 ˠ * [fold_left_map] is a combination of [fold_left] and [map] that threads an accumulator through calls to [f]. @since 4.11  O* [fold_left f init [b1; ...; bn]] is [f (... (f (f init b1) b2) ...) bn].  d* [fold_right f [a1; ...; an] init] is [f a1 (f a2 (... (f an init) ...))]. Not tail-recursive. =* {1 Iterators on two lists}  * [iter2 f [a1; ...; an] [b1; ...; bn]] calls in turn [f a1 b1; ...; f an bn]. @raise Invalid_argument if the two lists are determined to have different lengths. n * [map2 f [a1; ...; an] [b1; ...; bn]] is [[f a1 b1; ...; f an bn]]. @raise Invalid_argument if the two lists are determined to have different lengths. ͠ g* [rev_map2 f l1 l2] gives the same result as {!rev}[ (]{!map2}[ f l1 l2)], but is more efficient. , * [fold_left2 f init [a1; ...; an] [b1; ...; bn]] is [f (... (f (f init a1 b1) a2 b2) ...) an bn]. @raise Invalid_argument if the two lists are determined to have different lengths.  * [fold_right2 f [a1; ...; an] [b1; ...; bn] init] is [f a1 b1 (f a2 b2 (... (f an bn init) ...))]. @raise Invalid_argument if the two lists are determined to have different lengths. Not tail-recursive. ܠ4* {1 List scanning}  * [for_all f [a1; ...; an]] checks if all elements of the list satisfy the predicate [f]. That is, it returns [(f a1) && (f a2) && ... && (f an)] for a non-empty list and [true] if the list is empty. ] * [exists f [a1; ...; an]] checks if at least one element of the list satisfies the predicate [f]. That is, it returns [(f a1) || (f a2) || ... || (f an)] for a non-empty list and [false] if the list is empty. 젠 * Same as {!for_all}, but for a two-argument predicate. @raise Invalid_argument if the two lists are determined to have different lengths. Q * Same as {!exists}, but for a two-argument predicate. @raise Invalid_argument if the two lists are determined to have different lengths.  N* [mem a set] is true if and only if [a] is equal to an element of [set]. X j* Same as {!mem}, but uses physical equality instead of structural equality to compare list elements. 5* {1 List searching} ߠ * [find f l] returns the first element of the list [l] that satisfies the predicate [f]. @raise Not_found if there is no value that satisfies [f] in the list [l].  * [find f l] returns the first element of the list [l] that satisfies the predicate [f]. Returns [None] if there is no value that satisfies [f] in the list [l]. @since 4.05  * [find_index f xs] returns [Some i], where [i] is the index of the first element of the list [xs] that satisfies [f x], if there is such an element. It returns [None] if there is no such element. @since 5.1  * [find_map f l] applies [f] to the elements of [l] in order, and returns the first result of the form [Some v], or [None] if none exist. @since 4.10  * 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. @since 5.1 k * [filter f l] returns all the elements of the list [l] that satisfy the predicate [f]. The order of the elements in the input list is preserved.  -* [find_all] is another name for {!filter}. y * 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 4.11  8* {1 List manipulation}  Ӡ * [take n l] returns the prefix of [l] of length [n], or a copy of [l] if [n > length l]. [n] must be nonnegative. @raise Invalid_argument if [n] is negative. @since 5.3  s * [drop n l] returns the suffix of [l] after [n] elements, or [[]] if [n > length l]. [n] must be nonnegative. @raise Invalid_argument if [n] is negative. @since 5.3   * [take_while p l] is the longest (possibly empty) prefix of [l] containing only elements that satisfy [p]. @since 5.3  * [drop_while p l] is the longest (possibly empty) suffix of [l] starting at the first element that does not satisfy [p]. @since 5.3   * [partition f l] returns a pair of lists [(l1, l2)], where [l1] is the list of all the elements of [l] that satisfy the predicate [f], and [l2] is the list of all the elements of [l] that do not satisfy [f]. The order of the elements in the input list is preserved.  y * [partition_map f l] returns a pair of lists [(l1, l2)] such that, for each element [x] of the input list [l]: - if [f x] is [Left y1], then [y1] is in [l1], and - if [f x] is [Right y2], then [y2] is in [l2]. The output elements are included in [l1] and [l2] in the same relative order as the corresponding input elements in [l]. In particular, [partition_map (fun x -> if f x then Left x else Right x) l] is equivalent to [partition f l]. @since 4.12  8* {1 Association lists}  * [assoc a l] returns the value associated with key [a] in the list of pairs [l]. That is, [assoc a [ ...; (a,b); ...] = b] if [(a,b)] is the leftmost binding of [a] in list [l]. @raise Not_found if there is no value associated with [a] in the list [l].  < .* [assoc_opt a l] returns the value associated with key [a] in the list of pairs [l]. That is, [assoc_opt a [ ...; (a,b); ...] = Some b] if [(a,b)] is the leftmost binding of [a] in list [l]. Returns [None] if there is no value associated with [a] in the list [l]. @since 4.05  c* Same as {!assoc}, but uses physical equality instead of structural equality to compare keys.  M v* Same as {!assoc_opt}, but uses physical equality instead of structural equality to compare keys. @since 4.05 Π z* Same as {!assoc}, but simply return [true] if a binding exists, and [false] if no bindings exist for the given key. W g* Same as {!mem_assoc}, but uses physical equality instead of structural equality to compare keys. ࠠ {* [remove_assoc a l] returns the list of pairs [l] without the first pair with key [a], if any. Not tail-recursive. M ~* Same as {!remove_assoc}, but uses physical equality instead of structural equality to compare keys. Not tail-recursive. 5* {1 Lists of pairs}  * Transform a list of pairs into a pair of lists: [split [(a1,b1); ...; (an,bn)]] is [([a1; ...; an], [b1; ...; bn])]. Not tail-recursive.  * Transform a pair of lists into a list of pairs: [combine [a1; ...; an] [b1; ...; bn]] is [[(a1,b1); ...; (an,bn)]]. @raise Invalid_argument if the two lists have different lengths. Not tail-recursive. .* {1 Sorting} m * Sort a list in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see Array.sort for a complete specification). For example, {!Stdlib.compare} is a suitable comparison function. The resulting list is sorted in increasing order. {!sort} is guaranteed to run in constant heap space (in addition to the size of the result list) and logarithmic stack space. The current implementation uses Merge Sort. It runs in constant heap space and logarithmic stack space.  * Same as {!sort}, but the sorting algorithm is guaranteed to be stable (i.e. elements that compare equal are kept in their original order). The current implementation uses Merge Sort. It runs in constant heap space and logarithmic stack space. r P* Same as {!sort} or {!stable_sort}, whichever is faster on typical input.  * Same as {!sort}, but also remove duplicates: if multiple elements compare equal, keep only the first. @since 4.02 (4.03 in ListLabels) @before 5.4 the element kept was not necessarily the first one. j p* Merge two lists: Assuming that [l1] and [l2] are sorted according to the comparison function [cmp], [merge cmp l1 l2] will return a sorted list containing all the elements of [l1] and [l2]. If several elements compare equal, the elements of [l1] will be before the elements of [l2]. Not tail-recursive (sum of the lengths of the arguments). ̠:* {1 Lists and Sequences}  (* Iterate on the list. @since 4.07 Z 2* Create a list from a sequence. @since 4.07 @?)../ocamlc0-strict-sequence(-absname"-w5+a-4-9-41-42-44-45-48"-g+-warn-error"+A*-bin-annot)-nostdlib*-principal"-o0stdlib__List.cmi"-c'' D/builds/workspace/precheck/flambda/false/label/ocaml-linux-32/stdlib @@0Uv ^ 3''''''''@'@@8CamlinternalFormatBasics0%FU(Q/Tu&Stdlib0Lku]8_٠.Stdlib__Either0Vy`u~c à'0MYm 7R+Stdlib__Seq0nwzG&amg@0MYm 7RAI  "#9@@ J%%@ , @&F&|@%@@ǐ 2!Y!@Q@ G @@o| @I\@b@  !`@ V [@@ߐJR@@c@ > &O&>@=J@- !$%@@@cװw##@ ֐ C@@$2$@@K%]%@@ ֐7}@@@ @ H װt@@@m@@ՐT"}"ް"#A@@@@@g@@{@  @$$E@@@@T@~f$ɐ%@ W@@y&&@+@@&@[@@_"I"@@P@@