@@ -0,0 +1,1701 @@
+import me.elrod.pureio.*;%0A%0Aimport java.math.BigInteger;%0A%0A/**%0A * A simple example to show that our Trampoline%3CA%3E does what it should.%0A *%0A * The existence of this program is not meant to be a proof, but a%0A * demonstration.%0A *%0A * This could/should be turned into a test.%0A */%0Apublic class TrampolineWorks %7B%0A%0A    /**%0A     * This is a typical factorial function. It uses BigInteger because we are%0A     * interested in the stack complexity, not performance.%0A     *%0A     * This will overflow the stack if called with a large number.%0A     * e.g. fac(new BigInteger(%2210000000%22), BigInteger.ONE);%0A     */%0A    public static BigInteger fac(BigInteger x, BigInteger acc) %7B%0A        if (x.equals(BigInteger.ONE)) %7B%0A            return acc;%0A        %7D else %7B%0A            return fac(x.subtract(BigInteger.ONE), acc.multiply(x));%0A        %7D%0A    %7D%0A%0A    /**%0A     * This is a trampolined version of the above factorial function.%0A     *%0A     * It demonstrates that our trampoline does as we expect. While calling it%0A     * with a huge number takes a considerable amount of time to yield a result,%0A     * it never overflows the stack.%0A     */%0A    public static Trampoline%3CBigInteger%3E facT(BigInteger x, BigInteger acc) %7B%0A        if (x.equals(BigInteger.ONE)) %7B%0A            return Trampoline.pure(acc);%0A        %7D else %7B%0A            return Trampoline.suspend(new Identity%3CTrampoline%3CBigInteger%3E%3E() %7B%0A                    public Trampoline%3CBigInteger%3E run() %7B%0A                        return facT(x.subtract(BigInteger.ONE), acc.multiply(x));%0A                    %7D%0A                %7D);%0A        %7D%0A    %7D%0A%0A    public static void main(String%5B%5D a) %7B%0A        System.out.println(facT(new BigInteger(%2250000%22), BigInteger.ONE).run());%0A    %7D%0A%7D%0A

Add an example that shows a working trampoline