[Haskell-cafe] compare lengths of lists lazily

Alexey Khudyakov alexey.skladnoy at gmail.com
Mon Dec 19 17:34:42 CET 2011


On 19.12.2011 19:29, Henning Thielemann wrote:
>
> Shortest and most obfuscating solution I found is:
>
>
> import Data.Ord (comparing)
> import Control.Applicative ((<$))
>
> compareLength :: [a] -> [a] -> Ordering
> compareLength = comparing (()<$)
>
comparingLength = comparing void

It's two character shorter



More information about the Haskell-Cafe mailing list