[Haskell-cafe] Application of iterate

Ketil Malde Ketil.Malde at bccs.uib.no
Fri Mar 23 07:30:31 EDT 2007


Neil Mitchell wrote:
> close (x:y:xs) | abs (x - y) < 0.1 = y
> close (x:xs) = close xs
>
> I don't know how to add it into the one liner though - although I
> suspect someone here will :)
  head . head . filter (\(x:y:_) -> abs (x-y) < 0.1)

?

-k


More information about the Haskell-Cafe mailing list