Reputation: 67
i want to get the sum of tupples in a list. for an example
[("Isuru1","Ranasinghe1",123),("Isuru2","Ranasinghe2",123),("Isuru3","Ranasinghe3",123),("Isuru4","Ranasinghe4",123)]
in above list the answer has to be 4. please help me to solve this. i am new to haskell :(
Upvotes: 0
Views: 100
Reputation: 50858
Use the length
function. It gets the length of any list, no matter what's in it.
Example:
Prelude> length [("Isuru1","Ranasinghe1",123),("Isuru2","Ranasinghe2",123),("Isuru3","Ranasinghe3",123),("Isuru4","Ranasinghe4",123)]
4
Upvotes: 7