Skip to content

Latest commit

 

History

History
20 lines (12 loc) · 1.11 KB

README.md

File metadata and controls

20 lines (12 loc) · 1.11 KB

Lazyness in Ocaml with Syntax Extensions

LazySugar.ml provides force and delay operators implemented as synatic sugar using camlp5 preprocessor. This is completely useless since Ocaml already provides a Lazy module, but it was fun anyway :).

Delay and force can be expessed as syntactic sugar as follows:

equation

Usage

To compile LazySugar.ml:

$ ocamlc  -pp "camlp5o pa_extend.cmo q_MLast.cmo" -I +camlp5 -c LazySugar.ml

To use delay and force in an ocaml program, namely test.ml:

$ ocamlc -pp "camlp5o path/to/LazySugar.cmo" test.ml -o test