I am having two tuples in a list. For example: [("A",100,2),("B",50,3)]. I need to multiply the second and third elements of each and every tuple, sum the totals and show it. For example:
100* 2 = 200 (add this to a variable),
50* 3 = 150 (add this to the same variable),
Grant total = 350 (I want to display only this).
If any one can suggest me a solution for this it would be a great help for me.
foldl (\a (x, y, z) -> a + y*z) 0 [("A", 100, 2), ("B", 50, 3)]This expands to: ((0 + 100 * 2) + 50 * 3)