12345678910111213141516171819202122232425262728293031323334353637383940414243444546includeListletrecconcat_map_sep~sep~f=function|[]->[]|[x]->fx|x::xs->lethd=fxinlettl=concat_map_sep~sep~fxsinhd@(sep::tl)(* Since 4.10 *)letconcat_mapfl=letrecauxfacc=function|[]->revacc|x::l->letxs=fxinauxf(rev_appendxsacc)linauxf[]l(** @raise Failure if the list is empty. *)letreclast=function|[]->failwith"Odoc_utils.List.last"|[x]->x|_::tl->lasttl(* Since 4.10. Copied ocaml/ocaml *)letrecfind_mapf=function|[]->None|x::l->(matchfxwithSome_asresult->result|None->find_mapfl)(* Since 5.1 *)letis_empty=function[]->true|_::_->falseletrecskip_until~p=function|[]->[]|h::t->ifphthentelseskip_until~ptletsplit_at~flst=letrecloopacc=function|hd::_asrestwhenfhd->(List.revacc,rest)|[]->(List.revacc,[])|hd::tl->loop(hd::acc)tlinloop[]lst