Question: Define a function sumFstorSnds :: [(Integer, Integer)] -> Bool -> Integer which adds up either every first component in a list of tuples if the

Define a function

sumFstorSnds :: [(Integer, Integer)] -> Bool -> Integer

which adds up either every first component in a list of tuples if the second input is True or adds up every second component in a list of tuples if the second input is False

For example, sumFstorSnds [(1, 10), (2, 20)] True 3 and sumFstorSnds [(1, 10), (2, 20)] False = 30

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!