On 19/10/06, Brandon Moore <[EMAIL PROTECTED]> wrote:
isIdentity xs = xs == takeLengthOf xs [1..]
 where takeLengthOf xs ys = zipWith const ys xs

You probably mean zipWith (flip const) xs ys.

for finite lists,
takeLengthOf xs ys == take (length xs) ys

This ruins the laziness again:

Hugs.Base> let takeLengthOf xs ys = take (length xs) ys; isIdentity xs
= xs == takeLengthOf xs [1..] in isIdentity (1:3:2:[4..10000])
False
(210064 reductions, 278075 cells)
Hugs.Base> let takeLengthOf = zipWith (flip const); isIdentity xs = xs
== takeLengthOf xs [1..] in isIdentity (1:3:2:[4..1000])
False
(60 reductions, 114 cells)

--
-David House, [EMAIL PROTECTED]
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to