scryer-prolog
scryer-prolog copied to clipboard
Superfluous (is)/2?
With p/2 defined as:
p(A, B) :-
B is A + 3.
I get:
?- wam_instructions(p/2, Is), maplist(portray_clause, Is). get_variable(x(3),1). put_value(x(2),1). add(x(3),3,1). execute(is,2).
Can the execute(is,2) be removed? It seems that "adding 3", i.e., add(...) is everything that's needed here, if that primitive can be made to unify the result directly with B.
The add puts the sum into an intermediary value vector that's read by is/2.