i want to add some amounts which in my tuple. i want to take that out and total it and show. i want to use Foldr function.
can someone help me out how to do
i want to add some amounts which in my tuple. i want to take that out and total it and show. i want to use Foldr function.
can someone help me out how to do
Assuming you have a list of tuples, you probably want to start by reading up on the fold functions, perhaps here. It dives into foldl, but foldr is similar. It just works from the other end of the list. The graphical representation at the bottom of this other thread should help.
Once you've done that, you should be able to work out the details. I assume you already know how to get a value out of a tuple?