123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243type('t,'a,'accum)fold='t->init:'accum->f:(('accum->'a->'accum)[@local])->'accumtype('t,'a,'accum)foldi='t->init:'accum->f:((int->'accum->'a->'accum)[@local])->'accumtype('t,'a)iteri='t->f:((int->'a->unit)[@local])->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)[@local])->boolvalfor_alli:t->f:((int->elt->bool)[@local])->boolvalcounti:t->f:((int->elt->bool)[@local])->intvalfindi:t->f:((int->elt->bool)[@local])->(int*elt)optionvalfind_mapi:t->f:((int->elt->'aoption)[@local])->'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)[@local])->boolvalfor_alli:'at->f:((int->'a->bool)[@local])->boolvalcounti:'at->f:((int->'a->bool)[@local])->intvalfindi:'at->f:((int->'a->bool)[@local])->(int*'a)optionvalfind_mapi:'at->f:((int->'a->'boption)[@local])->'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)[@local])->boolvalfor_alli:('a,_)t->f:((int->'aelt->bool)[@local])->boolvalcounti:('a,_)t->f:((int->'aelt->bool)[@local])->intvalfindi:('a,_)t->f:((int->'aelt->bool)[@local])->(int*'aelt)optionvalfind_mapi:('a,_)t->f:((int->'aelt->'boption)[@local])->'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)[@local])->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)[@local])->tvalfilteri:t->f:((int->elt->bool)[@local])->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)[@local])->t(** [concat_mapi t ~f] is like concat_map. Additionally, it passes the index as an
argument. *)valconcat_mapi:t->f:((int->elt->t)[@local])->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)[@local])->'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)[@local])->'btvalfilteri:'at->f:((int->'a->bool)[@local])->'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)[@local])->'bt(** [concat_mapi t ~f] is like concat_map. Additionally, it passes the index as an
argument. *)valconcat_mapi:'at->f:((int->'a->'bt)[@local])->'btendmoduletypeGeneric_with_creators=sigincludeContainer.Generic_with_creatorsincludeGenericwithtype'aelt:='aeltandtype('a,'phantom)t:=('a,'phantom)tvalinit:int->f:((int->'aelt)[@local])->('a,_)tvalmapi:('a,'p)t->f:((int->'aelt->'belt)[@local])->('b,'p)tvalfilteri:('a,'p)t->f:((int->'aelt->bool)[@local])->('a,'p)tvalfilter_mapi:('a,'p)t->f:((int->'aelt->'beltoption)[@local])->('b,'p)tvalconcat_mapi:('a,'p)t->f:((int->'aelt->('b,'p)t)[@local])->('b,'p)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,'p)t:=('a,'p)tandtype'aelt:='aeltvalinit:[`Define_using_of_array|`Customofint->f:((int->'aelt)[@local])->('a,_)t]valconcat_mapi:[`Define_using_concat|`Customof('a,_)t->f:((int->'aelt->('b,_)t)[@local])->('b,_)t]endmoduletypeMake_gen_with_creators_arg=sigincludeContainer_intf.Make_gen_with_creators_argincludeMake_common_with_creators_argwithtype('a,'p)t:=('a,'p)tandtype'aelt:='aeltandtype('a,'p)concat:=('a,'p)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:((fun i x -> f i x; i + 1)[@local]))]. *)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)[@local])->int(** Generic definitions of indexed container operations in terms of [iteri]. *)valexistsi:iteri:('t,'a)iteri->'t->f:((int->'a->bool)[@local])->boolvalfor_alli:iteri:('t,'a)iteri->'t->f:((int->'a->bool)[@local])->boolvalfindi:iteri:('t,'a)iteri->'t->f:((int->'a->bool)[@local])->(int*'a)optionvalfind_mapi:iteri:('t,'a)iteri->'t->f:((int->'a->'boption)[@local])->'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,'phantom)t:=('a,'phantom)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,'phantom)t:=('a,'phantom)T.tandtype'aelt:='aT.eltandtype('a,'phantom)concat:=('a,'phantom)T.concatend