是否有“map head.group”的名称?

时间:2015-07-28 18:48:21

标签: haskell naming

函数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]

我在标准库中找不到此功能。是否有确定的名称?

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.