I'm new to Prolog and I have a problem that queries for calculator([three,times,two],Total). and yield the answer Total=6.
Following up on my previous question: I am using a predicate translate to have Prolog understand that [1,2,3,4,etc.] is [one,two,three,four,etc.].
translate([],[]).
translate([H|T],[H2|T2]):-means(H,H2),translate(T,T2).
means(0,zero).
means(1,one).
means(2,two).
means(3,three).
means(4,four).
means(5,five).
means(6,six).
means(9,nine).
means(10,ten).
I entered the query
?-translate([1,2,3,4],X).
X=[one,two,three,four].
Prolog translated the English numerical values to numbers. I just need help incorporating this translation to my arithmetic code.
calc([N1,times,N2],Total):-Total is N1*N2.
Any kind of advice would be appreciated. Thank You.