12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667moduleString=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=structletequal?(cmp=(=))ab=matcha,bwith|None,None->true|Somea,Someb->cmpab|_->falseletmapf=function|Somev->Some(fv)|None->Noneletbindf=function|Somev->fv|None->NoneendmoduleList=structincludeListletiterifxs=letrecloopi=function|[]->()|hd::tl->fihd;loop(i+1)tlinloop0xsend