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
- Host: GitHub
- URL: https://github.com/bapjiws/emulating-group-function
- Owner: bapjiws
- Created: 2015-10-14T18:45:42.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-10-14T18:50:36.000Z (about 10 years ago)
- Last Synced: 2025-01-28T16:44:21.080Z (11 months ago)
- Language: Haskell
- Homepage:
- Size: 195 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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]]