1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374moduleString=structincludeStringletstarts_withstrprefix=letlen=lengthprefixiniflengthstr<lenthenfalseelseletrecauxi=ifi>=lenthentrueelseifunsafe_getstri<>unsafe_getprefixithenfalseelseaux(i+1)inaux0letjoin=concatletimplodexs=letbuf=Buffer.create(List.lengthxs)inList.iter(Buffer.add_charbuf)xs;Buffer.contentsbufletfold_leftfinitstr=letlen=lengthstrinletrecloopiaccum=ifi=lenthenaccumelseloop(i+1)(faccumstr.[i])inloop0init(* Only available in the standard library since OCaml 4.02 *)letinitnf=lets=Bytes.createninfori=0ton-1doBytes.unsafe_setsi(fi)done;Bytes.to_stringsendmoduleOption=structletdefaultv=function|Somev->v|None->vletget=function|Somev->v|None->invalid_arg"PGOCaml_aux.Option.get"letmapf=function|Somev->Some(fv)|None->NoneendmoduleList=structincludeListletiterifxs=letrecloopi=function|[]->()|hd::tl->fihd;loop(i+1)tlinloop0xsletmapifxs=letrecloopi=function|[]->[]|hd::tl->lethd'=fihdinhd'::loop(i+1)tlinloop0xsend