Comparing the code for permutationgropus at http://www.polyomino.f2s.com/david/haskell/codeindex.html 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 of

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

and if so, what?

Best,
--
Mikael Johansson                 | To see the world in a grain of sand
[EMAIL PROTECTED]            |  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
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to