[Haskell-cafe] Hugs - evaluation statistics

Bulat Ziganshin bulatz at HotPOP.com
Mon Aug 29 06:01:36 EDT 2005


Hello Dusan,

Monday, August 29, 2005, 9:55:56 AM, you wrote:

>Nevertheless, for the other algorithm the expected time complexity  (
>quite well known in general :-) )  and measured values do no fit together.

number of reductions is not exact time statistics. try the following
alternative length definition ;)

length2 (_:_:_:_:_:_:_:_:_:_:xs) = (length2 xs)+10
length2 (_:xs)                   = (length2 xs)+1
length2 _                        = 0

and compare number of reductions for:

length [1..5000]
length2 [1..5000]


-- 
Best regards,
 Bulat                            mailto:bulatz at HotPOP.com





More information about the Haskell-Cafe mailing list