函数map head . group :: Eq a => [a] -> [a]
将相等的相邻值折叠为单个值。
与nub
相反,它不会删除等值后的所有。
例如:
nub [1,1,2,1] == [1,2]
(map head . group) [1,1,2,1] == [1,2,1]
我在标准库中找不到此功能。是否有确定的名称?
答案 0 :(得分:2)
No, such a function is not available in the standard libraries. A quick Hoogle query reveals that the only other function in the core libraries with the type of Eq a => [a] -> [a]
is nub
.