(no subject)

joosten@Anaxagoras.com joosten@Anaxagoras.com
Fri, 4 Jan 2002 11:47:46 +0100


I have performed research with Hugs quite a lot, and this is the first time
I have run into a real bug. I have isolated the bug into the following
program, which brings the Hugs interpreter down. Since an interpreter
should be something that never "crashes" (it should generate error messages
instead), I conclude that this must be a bug. Here is the program

>  testCycles rs = (paths, map shrink cycles)
>   where
>    shrink cycles     = dropWhile (/=last cycles) cycles
>    (paths, cycles)   = f (rd[[a]| (a,b)<-rs, not (a `elem` map snd rs)],
[])
>    f (paths,cs)
>     | null paths'    = (paths,cs)
>     | otherwise      = f (paths++paths',cs++paths'')
>                        where
>                         paths'  = rd[pth++[b]|pth<-paths, (a,b)<-rs, last
pth==a, not (b `elem` pth)]
>                         paths'' = rd[pth++[b]|pth<-paths, (a,b)<-rs, last
pth==a,      b `elem` pth ]

>  rd [] = []
>  rd (x:xs) = x: rd [e|e<-xs, e/=x]

It crashes when executed. Try for example the expression:

testCycles [(1,4),(4,5),(7,8),(3,2),(2,7)]


Yours,
Stef Joosten