[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon May 19 10:20:43 2000 
Subject:Re: My program dumps truth values 
From:Aaron Sloman See text for reply address 
Volume-ID:1000519.01 

[To reply replace "Aaron.Sloman.XX" with "A.Sloman"]

Matthew Sellers <msellers@bigpond.com> writes:

> Date: Fri, 19 May 2000 04:49:55 +1000
>
> I have written a search algorithm within a larger program.
> When the program is exited it returns something similar to the
> following.
> ** {<true> <true> <true> <true> <true> <true> <true> <true> <true>                   
> <true>                   
>            <true> <true> <true> <true> <true> <true> <true> <true>                   
> <true>                   
>            <true> <true> <true> <true> <true> <true> <true> <true>
> <true>
>            <true> <true> <true> <true> <true> <true> <true> <true>
> <true>
>            <true> <true> <true> <true> <true> <true> <true> <true>
> <true>
>            <true> <true> <true> <true> <true> <true> <true> <true>
> <true>
>            <true>}
>
> Where the number of <true> 's seems to depend on the number of search
> iterations called by the program.
> Since the values don't appear to come off the stack I do not understand
> the mechanism
> by which this is happening.
>
> Does someone know where these may be being generated?

The values can come only from the stack.

They can only be put there by your procedures.

One of your (probably recursive) procedures is leaving an extra
result on the stack, i.e. putting the true on the stack and then
not assigining to to anything, not storing it in any datastructure,
not passing it as an input to another procedure that uses it.

There are many ways this can happen. Sometimes it is fairly easy to
track down the source of the bug by using trace:

    See
        TEACH TRACE

and for more details see

        HELP TRACE

You may also find it useful at times to include temporary
instructions something like this

    'checkpoint 3 stacklength'=>
    stacklength() =>

at various points in a suspect program while debugging.

E.g. you may be invoking a procedure with one more argument than it
actually requires. Then the extra argument (the first one you give
it) will be left on the stack.

See also TEACH STACK

There's a more up to date version of this in the Birmingham Pop-11
teaching materials, see

    http://www.cs.bham.ac.uk/research/poplog/teach/stack

Chapter 3 of the Pop-11 primer may also be useful:

HTML version:
    http://www.cs.bham.ac.uk/research/poplog/primer/

Plain text version
    http://www.cs.bham.ac.uk/research/poplog/teach/primer

Aaron
===
Aaron Sloman, ( http://www.cs.bham.ac.uk/~axs/ )
School of Computer Science, The University of Birmingham, B15 2TT, UK
EMAIL A.Sloman AT cs.bham.ac.uk   (ReadATas@please !)
PAPERS: http://www.cs.bham.ac.uk/research/cogaff/
TOOLS: http://www.cs.bham.ac.uk/research/poplog/freepoplog.html