I'm working on a list that contains sublists with 2 elements each. The first element of each sublist is a string and the second one a number.
[ [e, 30], [a, 170], [k, 15], [e, 50] ]
I want to add all the numbers of each sublist. I tried this one:
sum_fire([H|T],S):-
flatten(H,L),
sum_fire(T,S),
L=[_H1|T1],
sum(T1,S).
but it's completely wrong, I think. How can i get this to work?