Daniel Fischer wrote: [snip]
Another thing, while toying, I found out that a comparison (n <= 0) takes three reductions more than (n < 1) according to my hugs, so changing the definition of splitAt thus, we require (3*n) reductions less.
That difference looks like it comes from the default definitions of (<) and (<=) in Ord, and the default definition of (/=) in Eq.
There's potential for Hugs to scrounge a little extra performance by going straight to case expressions in its Prelude:
Prelude> 1 >= 0
True
(28 reductions, 42 cells)
Prelude> 1 > 0
True
(25 reductions, 39 cells)
Prelude> let x `gt` y = case x `compare` y of GT -> True; _ -> False in 1 `gt` 0
True
(23 reductions, 37 cells)
Prelude> let x `ge` y = case x `compare` y of LT -> False; _ -> True in 1 `ge` 0
True
(23 reductions, 37 cells)
Regards, Tom
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
