I would like to know if someone could help me with a problem in prolog. I have to define two predicates but before that, I need to find out a way how to parse a list and form a number. For example [1,2,3] => 123. I tried different ways to do this but nothing works good. My code looks like this, I know it is not good but I can't find another way.
num([H|T],I,RI,RES):-
H2 is H * I,
R1 is RI + H2,
I2 is I/10,
RES2 is RES + R1,
num(T,I2,R1,RES2).