changeset ab35da49303e in joypy/Joypy details: http://hg.osdn.jp/view/joypy/Joypy?cmd=changeset;node=ab35da49303e user: Simon Forman <sform****@hushm*****> date: Mon Jul 15 11:20:13 2019 -0700 description: nullary combinator as definition. That eliminates all the recursive calls to thun/3 (outside of thun itself, which is tail recursive.) That means that this Joy interpreter is now fully CPS. All state is contained in the stack and expression, nothing is hidden in the Prolog "call stack". diffstat: thun/thun.pl | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diffs (20 lines): diff -r 6fd5d95f0a45 -r ab35da49303e thun/thun.pl --- a/thun/thun.pl Sun Jul 14 23:02:10 2019 -0700 +++ b/thun/thun.pl Mon Jul 15 11:20:13 2019 -0700 @@ -83,8 +83,6 @@ Functions */ -func(nullary, [P|S], [X|S]) :- thun(P, S, [X|_]). % Combinator. - func(cons, [A, B|S], [[B|A]|S]). func(swap, [A, B|S], [B, A|S]). func(dup, [A|S], [A, A|S]). @@ -159,6 +157,7 @@ infra ≡ [swons, swaack, [i], dip, swaack]. make_generator ≡ [[codireco], ccons]. neg ≡ [0, swap, -]. +nullary ≡ [stack, popd, [i], infra, first]. of ≡ [swap, at]. pm ≡ [[+], [-], cleave, popdd]. popd ≡ [[pop], dip].