1234567891011121314151617181920212223242526272829303132333435363738(* [List0] defines list functions that are primitives or can be simply defined in terms of
[Caml.List]. [List0] is intended to completely express the part of [Caml.List] that
[Base] uses -- no other file in Base other than list0.ml should use [Caml.List].
[List0] has few dependencies, and so is available early in Base's build order. All
Base files that need to use lists and come before [Base.List] in build order should do
[module List = List0]. Defining [module List = List0] is also necessary because it
prevents ocamldep from mistakenly causing a file to depend on [Base.List]. *)open!Import0lethd_exn=Caml.List.hdletlength=Caml.List.lengthletrev_append=Caml.List.rev_appendlettl_exn=Caml.List.tlletunzip=Caml.List.split(* These are eta expanded in order to permute parameter order to follow Base
conventions. *)letexistst~f=Caml.List.existst~fletexists2_okl1l2~f=Caml.List.exists2l1l2~fletfoldt~init~f=Caml.List.fold_leftt~f~initletfold2_okl1l2~init~f=Caml.List.fold_left2l1l2~init~fletfor_allt~f=Caml.List.for_allt~fletfor_all2_okl1l2~f=Caml.List.for_all2l1l2~fletitert~f=Caml.List.itert~fletiter2_okl1l2~f=Caml.List.iter2l1l2~fletnontail_mapt~f=Caml.List.mapt~fletnontail_mapit~f=Caml.List.mapit~fletpartitiont~f=Caml.List.partitiont~fletrev_mapt~f=Caml.List.rev_mapt~fletrev_map2_okl1l2~f=Caml.List.rev_map2l1l2~fletsortl~compare=Caml.List.sortl~cmp:compareletstable_sortl~compare=Caml.List.stable_sortl~cmp:compareletrev=function|([]|[_])asres->res|x::y::rest->rev_appendrest[y;x];;