Ralf Hautkappe wrote:
>
> good morning ;)
>
> i encountered a problem in refining my current kachel program... ( why did i
> start reading thinking forth....argl)
>
> the problerm is
>
> : test ( x y -- ) 0 ?do 0 ?do cr i . ." ," j . loop loop ;
>
> should give (yes i really expexted this):
> 2 2 test
> 0,0
> 0,1
> 1,0
> 1,1
>
> but it doesn't.... ( : test 2 0 ?do 2 0 ?do cr i . ." ," j . loop loop ;
> works ...)
> it gives
> 1 1
> 2 1
> 3 1
> ...
> 467 1
> ....
> 12384 1 and so on....
Well, I get (gforth on Linux):
0 ,0
1 ,0
*the terminal*:3: Stack underflow
2 2 test
^^^^
Backtrace:
$556E6744 (?do)
$1
$2
My guess is that, on your system, the stack underflow was not caught,
and on the second iteration of the outer loop, the inner loop got a
limit that would lead to lots of inner-looping.
So what you need to do is to supply a limit to the inner loop, e.g.:
: test ( x y -- ) 0 ?do dup 0 ?do cr i . ." ," j . loop loop drop ;
- anton
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]