Reimplement app1 and app2 as definitions.

This eliminates three recursive calls to thun/3.
This commit is contained in:
Simon Forman 2019-07-14 22:48:18 -07:00
parent f227cf0a57
commit 9f1e75313b
1 changed files with 4 additions and 4 deletions

View File

@ -83,10 +83,6 @@ literal(_/_).
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.
@ -145,6 +141,8 @@ r_truth(1, true).
Definitions
*/
app1 [grba, infra, first].
app2 [[grba, swap, grba, swap], dip, [infra, first], cons, ii].
at [drop, first].
b [[i], dip, i].
binary [unary, popd].
@ -156,7 +154,9 @@ dupd ≡ [[dup], dip].
dupdd [[dup], dipd].
fork [[i], app2].
fourth [rest, third].
grba [[stack, popd], dip].
ifte [[nullary], dipd, swap, branch].
ii [[dip], dupdip, i].
make_generator [[codireco], ccons].
neg [0, swap, -].
of [swap, at].