123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238type('t,'a,'accum)fold='t->init:'accum->f:('accum->'a->'accum)->'accumtype('t,'a,'accum)foldi='t->init:'accum->f:(int->'accum->'a->'accum)->'accumtype('t,'a)iteri='t->f:(int->'a->unit)->unitmoduletypeS0=sigincludeContainer.S0(** These are all like their equivalents in [Container] except that an index starting at
0 is added as the first argument to [f]. *)valfoldi:(t,elt,_)foldivaliteri:(t,elt)iterivalexistsi:t->f:(int->elt->bool)->boolvalfor_alli:t->f:(int->elt->bool)->boolvalcounti:t->f:(int->elt->bool)->intvalfindi:t->f:(int->elt->bool)->(int*elt)optionvalfind_mapi:t->f:(int->elt->'aoption)->'aoptionendmoduletypeS1=sigincludeContainer.S1(** These are all like their equivalents in [Container] except that an index starting at
0 is added as the first argument to [f]. *)valfoldi:('at,'a,_)foldivaliteri:('at,'a)iterivalexistsi:'at->f:(int->'a->bool)->boolvalfor_alli:'at->f:(int->'a->bool)->boolvalcounti:'at->f:(int->'a->bool)->intvalfindi:'at->f:(int->'a->bool)->(int*'a)optionvalfind_mapi:'at->f:(int->'a->'boption)->'boptionendmoduletypeGeneric=sigincludeContainer.Generic(** These are all like their equivalents in [Container] except that an index starting at
0 is added as the first argument to [f]. *)valfoldi:(('a,_,_)t,'aelt,_)foldivaliteri:(('a,_,_)t,'aelt)iterivalexistsi:('a,_,_)t->f:(int->'aelt->bool)->boolvalfor_alli:('a,_,_)t->f:(int->'aelt->bool)->boolvalcounti:('a,_,_)t->f:(int->'aelt->bool)->intvalfindi:('a,_,_)t->f:(int->'aelt->bool)->(int*'aelt)optionvalfind_mapi:('a,_,_)t->f:(int->'aelt->'boption)->'boptionendmoduletypeS0_with_creators=sigincludeContainer.S0_with_creatorsincludeS0withtypet:=tandtypeelt:=elt(** [init n ~f] is equivalent to [of_list [f 0; f 1; ...; f (n-1)]]. It raises an
exception if [n < 0]. *)valinit:int->f:(int->elt)->t(** [mapi] is like map. Additionally, it passes in the index of each element as the
first argument to the mapped function. *)valmapi:t->f:(int->elt->elt)->tvalfilteri:t->f:(int->elt->bool)->t(** filter_mapi is like [filter_map]. Additionally, it passes in the index of each
element as the first argument to the mapped function. *)valfilter_mapi:t->f:(int->elt->eltoption)->t(** [concat_mapi t ~f] is like concat_map. Additionally, it passes the index as an
argument. *)valconcat_mapi:t->f:(int->elt->t)->tendmoduletypeS1_with_creators=sigincludeContainer.S1_with_creatorsincludeS1withtype'at:='at(** [init n ~f] is equivalent to [of_list [f 0; f 1; ...; f (n-1)]]. It raises an
exception if [n < 0]. *)valinit:int->f:(int->'a)->'at(** [mapi] is like map. Additionally, it passes in the index of each element as the
first argument to the mapped function. *)valmapi:'at->f:(int->'a->'b)->'btvalfilteri:'at->f:(int->'a->bool)->'at(** filter_mapi is like [filter_map]. Additionally, it passes in the index of each
element as the first argument to the mapped function. *)valfilter_mapi:'at->f:(int->'a->'boption)->'bt(** [concat_mapi t ~f] is like concat_map. Additionally, it passes the index as an
argument. *)valconcat_mapi:'at->f:(int->'a->'bt)->'btendmoduletypeGeneric_with_creators=sigincludeContainer.Generic_with_creatorsincludeGenericwithtype'aelt:='aeltandtype('a,'phantom1,'phantom2)t:=('a,'phantom1,'phantom2)tvalinit:int->f:(int->'aelt)->('a,_,_)tvalmapi:('a,'p1,'p2)t->f:(int->'aelt->'belt)->('b,'p1,'p2)tvalfilteri:('a,'p1,'p2)t->f:(int->'aelt->bool)->('a,'p1,'p2)tvalfilter_mapi:('a,'p1,'p2)t->f:(int->'aelt->'beltoption)->('b,'p1,'p2)tvalconcat_mapi:('a,'p1,'p2)t->f:(int->'aelt->('b,'p1,'p2)t)->('b,'p1,'p2)tendmoduletypeMake_gen_arg=sigincludeContainer_intf.Make_gen_argvaliteri:[`Define_using_fold|`Customof(('a,_,_)t,'aelt)iteri]valfoldi:[`Define_using_fold|`Customof(('a,_,_)t,'aelt,_)foldi]endmoduletypeMake_arg=sigincludeContainer_intf.Make_argincludeMake_gen_argwithtype('a,_,_)t:='atandtype'aelt:='aendmoduletypeMake0_arg=sigincludeContainer_intf.Make0_argincludeMake_gen_argwithtype('a,_,_)t:=tandtype'aelt:=Elt.tendmoduletypeMake_common_with_creators_arg=sigincludeContainer_intf.Make_common_with_creators_argincludeMake_gen_argwithtype('a,'p1,'p2)t:=('a,'p1,'p2)tandtype'aelt:='aeltvalinit:[`Define_using_of_array|`Customofint->f:(int->'aelt)->('a,_,_)t]valconcat_mapi:[`Define_using_concat|`Customof('a,_,_)t->f:(int->'aelt->('b,_,_)t)->('b,_,_)t]endmoduletypeMake_gen_with_creators_arg=sigincludeContainer_intf.Make_gen_with_creators_argincludeMake_common_with_creators_argwithtype('a,'p1,'p2)t:=('a,'p1,'p2)tandtype'aelt:='aeltandtype('a,'p1,'p2)concat:=('a,'p1,'p2)concatendmoduletypeMake_with_creators_arg=sigincludeContainer_intf.Make_with_creators_argincludeMake_common_with_creators_argwithtype('a,_,_)t:='atandtype'aelt:='aandtype('a,_,_)concat:='atendmoduletypeMake0_with_creators_arg=sigincludeContainer_intf.Make0_with_creators_argincludeMake_common_with_creators_argwithtype('a,_,_)t:=tandtype'aelt:=Elt.tandtype('a,_,_)concat:='alistendmoduletypeDerived=sig(** Generic definitions of [foldi] and [iteri] in terms of [fold].
E.g., [iteri ~fold t ~f = ignore (fold t ~init:0 ~f:(local_ (fun i x -> f i x; i + 1)))]. *)valfoldi:fold:('t,'a,'acc)fold->('t,'a,'acc)foldivaliteri:fold:('t,'a,int)fold->('t,'a)iteri(** Generic definitions of indexed container operations in terms of [foldi]. *)valcounti:foldi:('t,'a,int)foldi->'t->f:(int->'a->bool)->int(** Generic definitions of indexed container operations in terms of [iteri]. *)valexistsi:iteri:('t,'a)iteri->'t->f:(int->'a->bool)->boolvalfor_alli:iteri:('t,'a)iteri->'t->f:(int->'a->bool)->boolvalfindi:iteri:('t,'a)iteri->'t->f:(int->'a->bool)->(int*'a)optionvalfind_mapi:iteri:('t,'a)iteri->'t->f:(int->'a->'boption)->'boptionendmoduletypeIndexed_container=sig(** Provides generic signatures for containers that support indexed iteration ([iteri],
[foldi], ...). In principle, any container that has [iter] can also implement [iteri],
but the idea is that [Indexed_container_intf] should be included only for containers
that have a meaningful underlying ordering. *)moduletypeDerived=DerivedmoduletypeGeneric=GenericmoduletypeGeneric_with_creators=Generic_with_creatorsmoduletypeS0=S0moduletypeS0_with_creators=S0_with_creatorsmoduletypeS1=S1moduletypeS1_with_creators=S1_with_creatorsincludeDerivedmoduleMake(T:Make_arg):S1withtype'at:='aT.tmoduleMake0(T:Make0_arg):S0withtypet:=T.tandtypeelt:=T.Elt.tmoduleMake_gen(T:Make_gen_arg):Genericwithtype('a,'phantom1,'phantom2)t:=('a,'phantom1,'phantom2)T.tandtype'aelt:='aT.eltmoduleMake_with_creators(T:Make_with_creators_arg):S1_with_creatorswithtype'at:='aT.tmoduleMake0_with_creators(T:Make0_with_creators_arg):S0_with_creatorswithtypet:=T.tandtypeelt:=T.Elt.tmoduleMake_gen_with_creators(T:Make_gen_with_creators_arg):Generic_with_creatorswithtype('a,'phantom1,'phantom2)t:=('a,'phantom1,'phantom2)T.tandtype'aelt:='aT.eltandtype('a,'phantom1,'phantom2)concat:=('a,'phantom1,'phantom2)T.concatend