[Haskell-cafe] List comparisons and permutation group code

Tomasz Zielonka tomasz.zielonka at gmail.com
Thu Oct 19 19:01:33 EDT 2006


On Thu, Oct 19, 2006 at 04:03:38PM +0200, Mikael Johansson wrote:
>   isIdentity (PL xs) = all (\(i,j) -> i==j) (zip [1..] xs)
> 
>   isIdentity (PL xs) = xs == [1..(length xs)]

How about a compromise?

    isIdentity (PL xs) = xs == zipWith const [1..] xs

Best regards
Tomasz


More information about the Haskell-Cafe mailing list