I was just writing a function that has a nested while loop, but it seems that 
the outer loop only executes once. I guess I must be missing something here.

while. r<{.$m
do.
        while. c<{:$m
        do.
                m =. (((<r;c){m) + ((<r;c-1){m) <. ((<c;~r-1){m)) (<r;c) } m
                c =. >:c
        end.
        r =. >:r
end.

Is there anything about that to suggest why the outer loop would only happen 
once?

I outputted 'r' at the end of the function and it returned 4 when the verb was 
applied to i.4 4 (which is what you would expect it to be having finished its 
loop).

Is there a way I can make my function output things part way through it? So I 
could see if I just have a logic error somewhere (which I cannot see but 
suspect is the issue) that causes the loop to appear to stop after the first 
iteration.

Thanks.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to