If I have three atoms X, Y and Z where
X = 1
Y = 2
Z = +
How do I put them together so that X Z Y = 3?
Edit: Using ThanosQR's univ solution, I have modified my code as follows:
% Parse list
parse_list([stop|_], _) :- !. % stop predicate if element is "stop"
parse_list([X, Y|Z]) :- % go through the list line by line
number(X, Number_1),
number(Z, Number_2),
operation(Y, Operation),
Line =.. [Operation, Number_1, Number_2],
Result is Line,
write(Result).
number(one, 1).
operation(plus, +). % etc... etc...
I get false... Not sure why..