dmgolubovsky / yhc

Automatically exported from code.google.com/p/yhc
0 stars 0 forks source link

yhi computes [1,1..] as [1,1,3,7,17,41,99,239,577,1393 ... #127

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Session illustrating the problem:

Thorkil-Naurs-Computer:~/tn/test/Yhc/digits-of-e2/work thorkilnaur$ cat T1.hs 
module T1 where
  main = putStr $ show $ take 10 $ [1,1..]
Thorkil-Naurs-Computer:~/tn/test/Yhc/digits-of-e2/work thorkilnaur$ yhc T1
Compiling T1               ( T1.hs )
Thorkil-Naurs-Computer:~/tn/test/Yhc/digits-of-e2/work thorkilnaur$ yhi T1
[1,1,3,7,17,41,99,239,577,1393]Thorkil-Naurs-Computer:~/tn/test/Yhc/digits-of-e2
/work 
thorkilnaur$ 

What is the expected output? What do you see instead?
I expected the result to be [1,1,1,1,1,1,1,1,1,1], not 
[1,1,3,7,17,41,99,239,577,1393].

Please use labels and text to provide additional information.
This explains the incorrect output from the nobench program digits-of-e2 
reported by Don 
(http://www.haskell.org/pipermail/yhc/2007-February/000704.html).

Original issue reported on code.google.com by thorkiln...@gmail.com on 26 Feb 2007 at 7:34

GoogleCodeExporter commented 9 years ago
I'll take a shot at tracking this one down, and marking it high priority 
because the
wrong answer is a bad thing!

Original comment by ndmitch...@gmail.com on 26 Feb 2007 at 9:51

GoogleCodeExporter commented 9 years ago
Fix pushed. A simple typo:

Int:      enumFromThen x y = x : enumFromThen y (2*y-x)
Integer:  enumFromThen x y = x : enumFromThen y (2*y+x)

I've now fixed the Integer one to match the Int one, and I get the right answer 
now.

Original comment by ndmitch...@gmail.com on 26 Feb 2007 at 10:16