Proposal: Add functions to get consecutive elements to Data.List
Henning Thielemann
lemming at henning-thielemann.de
Wed Apr 13 06:44:00 UTC 2016
On Wed, 13 Apr 2016, Andreas Abel wrote:
> I am neutral on this proposal. I grepped the Agda source (100kloc) for
> zip.*tail and get 6 uses that fall into your pattern.
> However, I am not so sure this warrants a new function, in the end
>
> zipConsecutivesWith f xs
>
> is not shorter than
>
> zipWith f xs (tail xs)
>
> unless xs is a long name.
Sometimes mapAdjacent allows partial application, like here:
> ./TypeChecking/Free/Tests.hs:54:strictlyAscending l = and $ zipWith (<) l $ tail l
and here
> ./Utils/List.hs:219:sorted xs = and $ zipWith (<=) xs (tail xs)
More information about the Libraries
mailing list