How to get the number of tuples in a list in Haskell
i want to get the sum of tupples in a list. for an example
[("Isuru1","Ranasinghe1",123),("Isuru2","Ranasinghe开发者_高级运维2",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 :(
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
精彩评论