简体   繁体   中英

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

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)]

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM