While learning about he new Camlp4 code I came across the apply operator
example provided with the OCaml 3.10.0 sources:
The ( & ) apply operator is implemented as a camlp4 filter in
apply_operator.ml:
----------------------------------------------------------
open Camlp4.PreCast;
AstFilters.register_str_item_filter
(Ast.map_expr
(fun
[ <:expr
loc< $e1$ & $e2$ >> -> <:expr
loc< $e1$ $e2$ >>
| e -> e ]))#str_item;
----------------------------------------------------------
And its use is demonstrated in apply_operator_test.ml:
----------------------------------------------------------
let ( & ) = ();; (* To force it to be inlined. If not it's not well typed. *)
fun f g h x -> f& g& h x
----------------------------------------------------------
I do not understand the comment and even after removing the first line
everything seems to still work fine.
Any explanations welcome! TIA.
--
Chris Stork <> Support eff.org! <> http://www.ics.uci.edu/~cstork/
OpenPGP fingerprint: B08B 602C C806 C492 D069 021E 41F3 8C8D 50F9 CA2F
.