summaryrefslogtreecommitdiff
path: root/ocaml-binary-annot/camlp4/examples/test_macros.ml
diff options
context:
space:
mode:
Diffstat (limited to 'ocaml-binary-annot/camlp4/examples/test_macros.ml')
-rw-r--r--ocaml-binary-annot/camlp4/examples/test_macros.ml15
1 files changed, 15 insertions, 0 deletions
diff --git a/ocaml-binary-annot/camlp4/examples/test_macros.ml b/ocaml-binary-annot/camlp4/examples/test_macros.ml
new file mode 100644
index 0000000000..1e1b172b5d
--- /dev/null
+++ b/ocaml-binary-annot/camlp4/examples/test_macros.ml
@@ -0,0 +1,15 @@
+(* DEFINE F(x, y, z) = x + y * z;; *)
+(* F(F(1, 2, 3), 4, 5);; *)
+
+(* !+ (1, 2, 3, 4);; *)
+
+(* foldl(( + ), 1, 2, 3, 4);; *)
+(* foldr(cons, 1, 2, 3, []);; *)
+
+let cons x xs = x :: xs;;
+
+def_foldl ( !+ ) ( + );;
+def_foldr ( !:: ) cons;;
+
+!+ (1, 2, 3, 4);;
+!:: (1, 2, 3, []);;