1234567891011121314151617181920212223242526272829303132333435open!Importletconstc_=cexternalignore:('a:any).('a[@local_opt])->unit@@portable="%ignore"[@@layout_poly](* this has the same behavior as [Stdlib.ignore] *)letnonfx=not(fx)letforeverf=letrecforever()=f();forever()intryforever()with|e->e;;externalid:('a:any).('a[@local_opt])->('a[@local_opt])@@portable="%identity"[@@layout_poly]external(|>):('a:any)('b:any).'a->(('a->'b)[@local_opt])->'b@@portable="%revapply"[@@layout_poly](* The typical use case for these functions is to pass in functional arguments and get
functions as a result. *)let%template[@modalityp=(nonportable,portable)]composefgx=f(gx)let%template[@modalityp=(nonportable,portable)]flipfxy=fyxletrecapply_n_times~nfx=ifn<=0thenxelseapply_n_times~n:(n-1)f(fx)