Re: More bugs
At 09:43 PM 6/18/98 -0400, Wally wrote:
>The guilty line used to say 'outlist = outlist & td'. The variable
>'outlist' is declared as a sequence, but at the beginning of the program it
>is blank, defined as {}. The variable td is declared as an atom. It
>doesn't work.
It should work fine, if you're sequence wasn't
building as you expected, you'll have to look at
where the atom td gets it's value from.
{}&a1 = {a1}
{a1}&a2 = {a1,a2}
{a1,a2}&a3 = {a1,a2,a3} ... etc
>After starting, the program changes a variable 'fd' from 0 to 1 to show that
>something has happened already. This might be on the first pass through the
>infinite loop, or on a later pass, or possibly never, but there is a
>provision to guarantee the eventual 'exit' in any case. I changed the
>'outlist' statement to an 'if-then' statement: 'if fd = 0 then outlist =
>{td} else outlist = append(outlist,{td})'.
If length(outlist) then ... would have worked
for this, but I don't think it's what you want:
append({a1},{a2}) = {a1,{a2}}
append({a1,{a2}},a3) = {a1,{a2},{a3}} ... etc
>No output.
I think this where you have to start.
How are you printing the output to the screen?
if you use print(1,outlist) you should see
something. Even if outlist is an empty
sequence print() will display "{}"
Maybe, for debugging purposes, you could put
print(1,outlist)
puts(1,"\n")
immediately after the
"outlist=outlist&td" line.
Then you could watch the sequence build.
>If you still want to see the Euphoria version, I'll send it. It has 151
>lines at present, including some extras thrown in to help while debugging,
>and some sections that haven't been debugged yet.
I'd be interested in taking a look at it.
Hope this helps,
Graeme.
----------------------------------------------------
|
Not Categorized, Please Help
|
|