On 6/27/06, Udo Stenzel <[EMAIL PROTECTED]> wrote:
Neil Mitchell wrote:
> Or if you don't want to go for a fold next, in a style more similar to
> the original:
>
> maximum [] = undefined
> maximum [x] = x
> maximum (a:b:xs) = maximum (max a b : xs)
It even reproduces the stack overflow, though for a different reason.
How about this:
maximum (a:b:xs) = maximum ((: xs) $! max a b)
--ihope
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe