An open API service indexing awesome lists of open source software.

https://github.com/bapjiws/emulating-group-function

A function that emulates Haskell group function from Data.List module
https://github.com/bapjiws/emulating-group-function

Last synced: 3 months ago
JSON representation

A function that emulates Haskell group function from Data.List module

Awesome Lists containing this project

README

          

**groupElems** takes a list and groups adjacent elements into sublists if they are equal.
It does exactly what **group** from **Data.List** module does, but uses only built-in functions from **Prelude**.

Here's how it works:



GHCi> groupElems []
[]
GHCi> groupElems [1,2]
[[1],[2]]
GHCi> groupElems [1,2,2,4]
[[1],[2,2],[4]]
GHCi> groupElems [1,2,3,2,4]
[[1],[2],[3],[2],[4]]