changeset fa3b1c7e23d4 in joypy/Joypy details: http://hg.osdn.jp/view/joypy/Joypy?cmd=changeset;node=fa3b1c7e23d4 user: Simon Forman <sform****@hushm*****> date: Sun Jul 14 21:58:20 2019 -0700 description: Got enough definitions, sort them. changeset 5afe5b816e4c in joypy/Joypy details: http://hg.osdn.jp/view/joypy/Joypy?cmd=changeset;node=5afe5b816e4c user: Simon Forman <sform****@hushm*****> date: Sun Jul 14 22:48:18 2019 -0700 description: Reimplement app1 and app2 as definitions. This eliminates three recursive calls to thun/3. changeset 6fd5d95f0a45 in joypy/Joypy details: http://hg.osdn.jp/view/joypy/Joypy?cmd=changeset;node=6fd5d95f0a45 user: Simon Forman <sform****@hushm*****> date: Sun Jul 14 23:02:10 2019 -0700 description: Infra as definition. diffstat: thun/thun.pl | 62 ++++++++++++++++++++++++++++++------------------------------ 1 files changed, 31 insertions(+), 31 deletions(-) diffs (89 lines): diff -r 9a63081793fe -r 6fd5d95f0a45 thun/thun.pl --- a/thun/thun.pl Sun Jul 14 21:14:50 2019 -0700 +++ b/thun/thun.pl Sun Jul 14 23:02:10 2019 -0700 @@ -83,12 +83,7 @@ Functions */ -func(app1, [P, Xi|S], [Xo|S]) :- thun(P, [Xi|S], [Xo|_]). % Combinator. -func(app2, [P, Xi, Yi|S], [Xo, Yo|S]) :- thun(P, [Xi|S], [Xo|_]), % Combinator. - thun(P, [Yi|S], [Yo|_]). - func(nullary, [P|S], [X|S]) :- thun(P, S, [X|_]). % Combinator. -func(infra, [P, R|S], [Q|S]) :- thun(P, R, Q). % Combinator. func(cons, [A, B|S], [[B|A]|S]). func(swap, [A, B|S], [B, A|S]). @@ -145,41 +140,46 @@ Definitions */ -swons ≡ [swap, cons]. -unswons ≡ [uncons, swap]. -x ≡ [dup, i]. +app1 ≡ [grba, infra, first]. +app2 ≡ [[grba, swap, grba, swap], dip, [infra, first], cons, ii]. +at ≡ [drop, first]. b ≡ [[i], dip, i]. -sqr ≡ [dup, *]. +binary ≡ [unary, popd]. +ccons ≡ [cons, cons]. +cleave ≡ [fork, [popd], dip]. +codireco ≡ [cons, dip, rest, cons]. +drop ≡ [[rest], times]. +dupd ≡ [[dup], dip]. +dupdd ≡ [[dup], dipd]. +fork ≡ [[i], app2]. +fourth ≡ [rest, third]. +grba ≡ [[stack, popd], dip]. ifte ≡ [[nullary], dipd, swap, branch]. -while ≡ [swap, [nullary], cons, dup, dipd, concat, loop]. -popop ≡ [pop, pop]. -ccons ≡ [cons, cons]. -unary ≡ [nullary, popd]. -binary ≡ [unary, popd]. -trinary ≡ [binary, popd]. +ii ≡ [[dip], dupdip, i]. +infra ≡ [swons, swaack, [i], dip, swaack]. +make_generator ≡ [[codireco], ccons]. +neg ≡ [0, swap, -]. +of ≡ [swap, at]. +pm ≡ [[+], [-], cleave, popdd]. popd ≡ [[pop], dip]. popdd ≡ [[pop], dipd]. +popop ≡ [pop, pop]. popopd ≡ [[popop], dip]. popopdd ≡ [[popop], dipd]. -dupd ≡ [[dup], dip]. -dupdd ≡ [[dup], dipd]. +product ≡ [1, swap, [*], step]. +rrest ≡ [rest, rest]. second ≡ [rest, first]. +size ≡ [0, swap, [pop, 1, +], step]. +sqr ≡ [dup, *]. +sum ≡ [0, swap, [+], step]. +swons ≡ [swap, cons]. third ≡ [rest, second]. -fourth ≡ [rest, third]. -rrest ≡ [rest, rest]. +trinary ≡ [binary, popd]. +unary ≡ [nullary, popd]. unit ≡ [[], cons]. -drop ≡ [[rest], times]. -at ≡ [drop, first]. -of ≡ [swap, at]. -sum ≡ [0, swap, [+], step]. -product ≡ [1, swap, [*], step]. -size ≡ [0, swap, [pop, 1, +], step]. -fork ≡ [[i], app2]. -cleave ≡ [fork, [popd], dip]. -codireco ≡ [cons, dip, rest, cons]. -make_generator ≡ [[codireco], ccons]. -neg ≡ [0, swap, -]. -pm ≡ [[+], [-], cleave, popdd]. +unswons ≡ [uncons, swap]. +while ≡ [swap, [nullary], cons, dup, dipd, concat, loop]. +x ≡ [dup, i]. /*