haskell - Summing a list of tuples -
i have list of tuples containing intergers.
[(123,123,123),(123,123,123),(123,123,123)]
i want sum of second values of list eg;
[(_,123,_),(_,123,_),(_,123,_)]
123 + 123 + 123
i think should using fold im not sure
extract second value list of tuple list new list , sum new list.
prelude> let = [(123,123,123),(123,123,123),(123,123,123)] prelude> sum [i | (_,i,_) <- a]
Comments
Post a Comment