ppx_getenv.ml :: A Simple compile time text generator [fn:1].
ppx_addone.ml :: Deep map 1+ for constant integers at compile time. i.e., 1 + 2 –> 2 + 3. Referenced [fn:2] but didn’t follow completely.
let _ = [%addone 1 + 2]
let _ = [%addone 1 * (2 + 3 * 4)]
let _ = 2 + 3
let _ = 2 * (3 + (4 * 5))
ppx_equiv.ml :: A simple translator of bi-imply to conjunction of implications. a <==> b to (a ==> b) && (b ==> a).
let (==>) a b = not (a && not b)
let (<==>) a b = (a ==> b) && (b ==> a)
(* I want to expand <==> in this.*)
let equiv_theorem a b c =
[%equiv ((a <==> b) <==> c) <==> (a <==> (b <==> c))]
let _ = [%equiv true <==> false]
let (==>) a b = not (a && (not b))
let (<==>) a b = (a ==> b) && (b ==> a)
let equiv_theorem a b c =
(((((a ==> b) && (b ==> a)) ==> c) && (c ==> ((a ==> b) && (b ==> a)))) ==>
((a ==> ((b ==> c) && (c ==> b))) && (((b ==> c) && (c ==> b)) ==> a)))
&&
(((a ==> ((b ==> c) && (c ==> b))) && (((b ==> c) && (c ==> b)) ==> a))
==>
((((a ==> b) && (b ==> a)) ==> c) && (c ==> ((a ==> b) && (b ==> a)))))
let _ = (true ==> false) && (false ==> true)
ppx_arith.ml :: A rewriter for arithmetic expressions.
let _ = [%arith 1 + (2 * 3) - (4 / 7)]
let _ = Sub (Add 1 (Mul 2 3)) (Div 4 7)
[fn:2] https://www.victor.darvariu.me/jekyll/update/2018/06/19/ppx-tutorial.html
[fn:1] https://whitequark.org/blog/2014/04/16/a-guide-to-extension-points-in-ocaml/