Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个看起来像这样的嵌套列表:
let i = [(6, 0.2), (4, 0.9), (12, 0.1)]
我有兴趣找到第二个元素最小的元素:
(12, 0.1)
我试图使用最小值,但显然这不起作用。如何找到嵌套列表的最小值?
minimum (\(x, y) -> y) lst
使用minimumBy,comparing和snd:
minimumBy
comparing
snd
minimumBy (comparing snd)