Consider adding `converge` and friends.

Henning Thielemann lemming at henning-thielemann.de
Thu Aug 20 16:41:49 UTC 2020


On Thu, 20 Aug 2020, Ignat Insarov wrote:

> This function first appeared _(to my knowledge)_ in [a Stack Overflow
> answer][1]. I found it useful several times, and eventually [I extended it to a
> family of 4 derived functions][2]: `converge`, `convergeBy`, `fixp` and
> `fixpBy`.
>
> * `convergeBy` is like `takeWhile` but with a binary predicate.
> * `converge` cuts a list at a point where it starts to repeat itself.
> * `fixp` takes the last element.

This one may help:
https://hackage.haskell.org/package/utility-ht-0.0.15/docs/Data-List-HT.html#v:mapAdjacent


More information about the Libraries mailing list