Haskell - Remove elements in a list of tuples that are greater than n

Viewed 57

how would i remove elements in a list of tuples that are greater than n?

the list of tuples is like so: [("abcde",1),("fghi",5),("jklm",10)]

etc if i was to remove elements greater than 6:

 [("abcde",1),("fghi",5)]
1 Answers

You could do it with filter and a lambda like so:

filter (\(a,b) -> b < 7 ) list
Related