[Haskell-cafe] List comparisons and permutation group code

Mikael Johansson mikael at johanssons.org
Thu Oct 19 10:03:38 EDT 2006

Comparing the code for permutationgropus at 
with my own thoughts on the matter, I discover the one line to figure out 
whether a specific list represents the identity:

   isIdentity (PL xs) = all (\(i,j) -> i==j) (zip [1..] xs)

Is there any sort of benefit to be won by using this construction instead 

   isIdentity (PL xs) = xs == [1..(length xs)]

and if so, what?

Mikael Johansson                 | To see the world in a grain of sand
mikael at johanssons.org            |  And heaven in a wild flower
http://www.mikael.johanssons.org | To hold infinity in the palm of your hand
                                  |  And eternity for an hour

More information about the Haskell-Cafe mailing list