Should anybody be interested, here are some further developments. 

Simon Peyton-Jones <[EMAIL PROTECTED]> writes:

>> hugs apparently runs the program about as fast as compiled Scheme

Heh, in my na�ve translation, I have replaced do-loops in Scheme with
lists in Haskell, inadvertently memoizing a couple of things, most
significant, I guess, is the "zark" function.  Thus, what used to be
(I guess) an O(n^2)*O(zark) complexity, now became an
O(n^2)+O(n*zark). Or something.

I've rewritten to use recursion, which makes Hugs use about an hour,
compared to a reported 10 minutes for Scheme (still on a slightly
faster machine).  I assume proper tail recursion should eliminate most
of the difference, but I haven't gotten around to it.  (Yet?)

>> and a compilation with GHC brings it down to about zero
>> (0.7s to be exact), but returns 0 instead of some large number.

I can't get the recursive version to compile with GHC, GHC can't find
"fromInt", which I could have sworn was in the Prelude.  Any hints?

I guess it will still compute the whole thing compile time, and run in 
essentially zero time.  Pretty neat, I think.

> 2^11s in the middle!   GHC is not doing any analytic work.  

Damn, I attributed the Hugs result to truncation/rounding errors, without
really thinking about the algorithm or the returned value.

> I assume that the answer is supposed to be zero, right? 

Correct.

> I conclude that there may be a bug in Hugs, so I'm sending this to
> the Hugs bugs list.

Ah good.  Perhaps I should subscribe, I'm really curious what may
cause such an error.  (That's what you get for writing software in C.
Boo! Boo!)

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants

Reply via email to