Nice demonstration of preprocessor powers.<p>Compiling this file (cd examples; cmake .; make) took just under half a minute.
Adding an exponentiation test<p><pre><code> #define POW LAM(LAM(APPL(VAR(1), VAR(2))))
#define TWO_TO_THE_FOUR APPL(APPL(POW, TWO), FOUR)
#define FOUR_SQUARED APPL(APPL(POW, FOUR), TWO)
ASSERT_REDUCES_TO(TWO_TO_THE_FOUR, FOUR_SQUARED);
</code></pre>
nearly doubles the time.<p>Adding some Pythagoras<p><pre><code> #define FIVE APPL(SUCC, FOUR)
#define SQUARE LAM(APPL(APPL(MUL, VAR(1)), VAR(1)))
ASSERT_REDUCES_TO(APPL(APPL(ADD, APPL(SQUARE, THREE)), APPL(SQUARE, FOUR)), APPL(SQUARE, FIVE));
</code></pre>
bumps the time to 3 minutes.<p>Currying works fine too; one can simplify the definitions<p><pre><code> #define IF LAM(LAM(LAM(APPL(APPL(VAR(3), VAR(2)), VAR(1)))))
#define MUL LAM(LAM(LAM(LAM(APPL(APPL(VAR(4), APPL(VAR(3), VAR(2))), VAR(1))))))
</code></pre>
to<p><pre><code> #define I LAM(VAR(1))
#define IF I
#define MUL LAM(LAM(LAM(APPL(VAR(3), APPL(VAR(2), VAR(1))))))
</code></pre>
I tried to see at what point things break; perhaps at this point<p><pre><code> #define SEVENTEEN APPL(SUCC, APPL(SQUARE, FOUR))
#define FOUR_CUBED APPL(APPL(POW, FOUR), THREE)
#define THREE_TO_THE_FOUR APPL(APPL(POW, THREE), FOUR)
ASSERT_REDUCES_TO(APPL(APPL(ADD, FOUR_CUBED), SEVENTEEN), THREE_TO_THE_FOUR);
</code></pre>
that yields an error: pasting formed ';_IMPL', an invalid preprocessing token<p>I like the choice of False for Nil, which I also made in my Binary Lambda Calculus [1]<p>[1] <a href="https://tromp.github.io/cl/Binary_lambda_calculus.html#Delimited_versus_undelimited" rel="nofollow">https://tromp.github.io/cl/Binary_lambda_calculus.html#Delim...</a>