[Haskell-cafe] inv f g = f . g . f

Tobias Dammers tdammers at gmail.com
Sat Aug 17 16:52:38 CEST 2013


Note that at least for the dropWhile example, there is a specialized
function, dropWhileEnd, which is most likely more efficient than reversing
the list twice.
On Aug 17, 2013 3:35 PM, "Tom Ellis" <
tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote:

> On Sat, Aug 17, 2013 at 11:11:07AM +0200, Christopher Done wrote:
> > Anyone ever needed this? Me and John Wiegley were discussing a decent
> > name for it, John suggested inv as in involution. E.g.
> >
> > inv reverse (take 10)
> > inv reverse (dropWhile isDigit)
> > trim = inv reverse (dropWhile isSpace) . dropWhile isSpace
>
> This sounds like a job for a lens, or similar.
>
> Tom
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130817/1e4d5e3c/attachment.htm>


More information about the Haskell-Cafe mailing list