I need help in the prologue, which is quite new to me. I have to develop a small arithmetic computer. The expression to be evaluated will be presented in a list, for example:
?-evaluate([2,+,4,*,5,+,1,*,2,*,3],R).
I am trying to do this by creating two predicates, one of which is called parse to convert my list, for example:
?-parse([1,+,2,*,3],PF).
PF=[+,1,[*,2,3]]
and the other to evaluate the new expression.
?-evpf([+,1,[*,2,3]],R).
R=7
I have problems with the first part, can someone help me with the code?
user1137267
source
share