On Tue, Nov 1, 2011 at 8:54 PM, David Vaughan
<[email protected]> wrote:
> 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.

When I am debugging with loops, I almost always wind up using
smoutput.  Perhaps something like this:

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

This winds up being a bit bulky.  If I am really concerned about that,
I can get fancier:

       smoutput }.}:":'r';r =. >:r

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

Reply via email to