Add partitioning functions to Data.List
The functions take and span have recursive equivalents takeRec and spanRec that apply the same function to the remainder, i.e.
takeRec i xs = let (hs,ts) = splitAt i xs in hs : takeRec i xs
spanRec p xs = let (hs,ts) = span p xs in hs : spanRec p xs
and the more generic version of take:
genericTakeRec i xs = let (hs,ts) = genericSplitAt i xs in hs : genericTakeRec i xs
These functions, to me, are in the same league as partition and group, can be added with little chance of nameclashes on functions with a different meaning and are not named compositions.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 6.12.1 RC1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | libraries/base |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |