it is possible to use the only goal project to test clauses like this.
Code: Select all
class predicates
power1:(real, integer, real).
clauses
power1(A,B,C):-
bound(A),bound(B),!,
C=exp(B*ln(A)).
goal
power1(4,3,D).
thanks
Code: Select all
class predicates
power1:(real, integer, real).
clauses
power1(A,B,C):-
bound(A),bound(B),!,
C=exp(B*ln(A)).
goal
power1(4,3,D).
Code: Select all
implement main
open core
class predicates
power1 : (real, integer, real [out]).
clauses
power1(A, B, C) :-
bound(A),
bound(B),
!,
C = math::exp(B * math::ln(A)).
clauses
run() :-
power1(4, 4, C),
stdio::write(" c = ", C),
_ = console::readChar().
end implement main
goal
console::runUtf8(main::run).
Code: Select all
class predicates
power1 : (real A, integer B, real PowerAB [out]).
clauses
power1(A, B, C) :-
C = math::exp(B * math::ln(A)).
clauses
run() :-
power1(4, 3, D),
stdio::write("\n", D),
_ = console::readLine().
end implement main
goal
console::runUtf8(main::run).
Code: Select all
clauses
run() :-
stdio::writef("Power(4, 3) = %\n", 4 ^ 3).