> Surely not... sum is defined by Haskell 98 as:
> 
>  sum = foldl (+) 0
> 
> and this is exactly what GHC provides.  Furthermore we have 
> specialised strict versions for Int and Integer.
> 

I'd been using ghci for testing along the way and getting terrible
results; does the specialization only apply to ghc per se?

> 
> Cheers,
>       Simon
> 

Also, Cale, I was thinking about your comment about formal power series,
and I don't see that (+) should not be strict in this case. In
particular, if they are represented as infinite lists, I agree that
zipWith (+) works just fine, though it is strict but lazy.

Here is the strictness:
zipWith (+) undefined [1,2,3] == undefined
zipWith (+) [1,2,3] undefined == undefined

And here is the laziness:
head $ zipWith (+) (1:undefined) (2:undefined) == 3

Or am I missing something?

-Chad
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to