I am trying to make a tail recursive helper for power predicate in Prolog. So far I have this but when testing I get a message saying there is a breakpoint when trying to call helper predicate. What am I doing wrong? Ty for the help.
trpow(Base, Exp, Res) :- trpow_helper(Base, Exp, 1, Res).
trpow_helper(_, 0, Acc, Acc).
trpow_helper(Base, Exp, Acc, Res) :-
Exp > 0,
Decexp is Exp - 1,
Acc1 is Acc * Base,
Res = Acc1,
trpow_helper(Base, Decexp, Acc1, Res).