Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file list.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209includeListLabelstype'at='alistletmap~ft=rev(rev_map~ft)letis_empty=function|[]->true|_->falseletis_non_empty=function|[]->false|_->trueletfilter_mapl~f=letrecloopacc=function|[]->revacc|x::xs->(matchfxwith|None->loopaccxs|Somex->loop(x::acc)xs)inloop[]lletfilter_optl=filter_map~f:(funx->x)lletfilteril~f=letrecfilterili=matchlwith|[]->[]|x::l->leti'=succiiniffixthenx::filterili'elsefilterili'infilteril0letconcat_mapl~f=concat(mapl~f)letrecrev_map_appendl1l2~f=matchl1with|[]->l2|a::l->rev_map_appendl(fa::l2)~fletrev_partition_map=letreclooplacclaccr~f=matchlwith|[]->(accl,accr)|x::l->(match(fx:(_,_)Either.t)with|Lefty->loopl(y::accl)accr~f|Righty->looplaccl(y::accr)~f)infunl~f->loopl[][]~fletpartition_mapl~f=letl,r=rev_partition_mapl~fin(revl,revr)type('a,'b)skip_or_either=|Skip|Leftof'a|Rightof'bletrev_filter_partition_map=letreclooplacclaccr~f=matchlwith|[]->(accl,accr)|x::l->(matchfxwith|Skip->looplacclaccr~f|Lefty->loopl(y::accl)accr~f|Righty->looplaccl(y::accr)~f)infunl~f->loopl[][]~fletfilter_partition_mapl~f=letl,r=rev_filter_partition_mapl~fin(revl,revr)letrecfind_mapl~f=matchlwith|[]->None|x::l->(matchfxwith|None->find_mapl~f|Some_asres->res)letrecfindl~f=matchlwith|[]->None|x::l->iffxthenSomexelsefindl~fletfind_exnl~f=matchfindl~fwith|Somex->x|None->Code_error.raise"List.find_exn"[]letreclast=function|[]->None|[x]->Somex|_::xs->lastxsletdestruct_last=letrecloopacc=function|[]->None|[x]->Some(revacc,x)|x::xs->loop(x::acc)xsinfunxs->loop[]xsletsortt~compare=sortt~cmp:(funab->Ordering.to_int(compareab))letstable_sortt~compare=stable_sortt~cmp:(funab->Ordering.to_int(compareab))letsort_uniqt~compare=Stdlib.List.sort_uniq(funab->Ordering.to_int(compareab))tletreccompareab~compare:f:Ordering.t=match(a,b)with|[],[]->Eq|[],_::_->Lt|_::_,[]->Gt|x::a,y::b->(match(fxy:Ordering.t)with|Eq->compareab~compare:f|ne->ne)letrecassoctx=matchtwith|[]->None|(k,v)::t->ifx=kthenSomevelseassoctxletsingletonx=[x]letrecnthti=match(t,i)with|[],_->None|x::_,0->Somex|_::xs,i->nthxs(i-1)letphysically_equal=Stdlib.(==)letinit=letrecloopaccinf=ifi=nthenrevaccelseloop(fi::acc)(i+1)nfinfunn~f->loop[]0nflethd_opt=function|[]->None|x::_->Somexletrecequaleqxsys=match(xs,ys)with|[],[]->true|x::xs,y::ys->eqxy&&equaleqxsys|_,_->falselethashfxs=Stdlib.Hashtbl.hash(map~fxs)letconsxxs=x::xs(* copy&paste from [base] *)letfold_mapt~init~f=letacc=refinitinletresult=mapt~f:(funx->letnew_acc,y=f!accxinacc:=new_acc;y)in(!acc,result)letunzipl=fold_right~init:([],[])~f:(fun(x,y)(xs,ys)->(x::xs,y::ys))lletrecfor_all2xy~f=match(x,y)with|[],[]->Oktrue|x::xs,y::ys->iffxythenfor_all2xsys~felseOkfalse|_,_->Error`Length_mismatchletreducexs~f=matchxswith|[]->None|init::xs->Some(fold_leftxs~init~f)letminxs~f=reducexs~f:(Ordering.minf)letmaxxs~f=reducexs~f:(Ordering.maxf)