[Haskell-cafe] List comparisons and permutation group code

Henk-Jan van Tuyl hjgtuyl at chello.nl
Fri Oct 20 12:08:26 EDT 2006


How about this:
   import List
   isIdentity (PL xs) =  xs `isPrefixOf` [1..]
?

Best regards,
Henk-Jan van Tuyl


On Fri, 20 Oct 2006 01:01:33 +0200, Tomasz Zielonka  
<tomasz.zielonka at gmail.com> wrote:

> 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
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



-- 
Met vriendelijke groet,
Henk-Jan van Tuyl


--
http://Van.Tuyl.eu/
--

Using Opera's revolutionary e-mail client:
https://secure.bmtmicro.com/opera/buy-opera.html?AID=789433



More information about the Haskell-Cafe mailing list