[a] -> [a] function map head . group :: Eq a => [a] -> [a] map head . group :: E...">

Is there a name for "map head. Group"?

map head . group :: Eq a => [a] -> [a] function map head . group :: Eq a => [a] -> [a] map head . group :: Eq a => [a] -> [a] collapses equal adjacent values โ€‹โ€‹into a single value. Unlike nub , it does not delete all of the following equal values.

For instance:

 nub [1,1,2,1] == [1,2] (map head . group) [1,1,2,1] == [1,2,1] 

I could not find this function in the standard library. Is this name set?

+4
source share
1 answer

No, such a function is not available in standard libraries. A quick Hoogle query shows that the only other function in core libraries of type Eq a => [a] -> [a] is nub .

+2
source

All Articles