13!:19 is supposed to cut back the stack during debugging.
I've been having problems with this, and there has been talk about
decomissioning the j801 instance of the J debugger because of my problems.
Here's an illustration of these problems which (a) does not involve the
ide, and (b) does not involve any foreigns (other than the 13!: foreigns
used for debugging):
First, definitions:
aget=: {&(i.3 4)@|
anul=: 0 0 0 0"_
bget=: {&(-p:i.3 5)
bnul=: 0 0 0 0 0"_
bonly=: anul,bget
aonly=: aget,bnul
both=: aget,bget
get=: [:`bonly`both`aonly@.(3&#.@:*)
With these definitions in place, and a fresh j801 jqt instance, I see the
following behavior:
First, let's generate an index error:
get 4
|index error: bget
| get 4
simple enough. Now, let's turn on debugging and try that again:
13!:0]1
get 4
|index error: bget
|bget[0]
;:inv {."1]13!:13''
bget bonly get
Here, I see that 'get' called 'bonly' which in turn called 'bget', which is
where the index error happened.
Now let's cut back the stack:
13!:19 ''
|index error: bget
|bget[0]
;:inv {."1]13!:13''
bget bonly get
... um... that was supposed to cut back the stack. Let's try that again:
13!:19 ''
;:inv {."1]13!:13''
bonly get
perfect! This time it behaved exactly like it was supposed to behave.
Now, let's try that again:
13!:19 ''
|index error: bget
|bget[0]
;:inv {."1]13!:13''
bget bonly get
A picture is worth a thousand words, so:
http://31.media.tumblr.com/f3e5a3a867c285c003c66a12d9a26552/tumblr_mtpw2zQKNP1sj6vefo1_500.gif
I totally understand that debuggers are a pain to write. Somehow you need
code which does the right thing with errors. But I'm not the only one that
has to deal with this headache, and maybe with this as a test case someone
can feel motivated enough to find the issue. (And, as a bonus, perhaps
write a simple test case to illustrate it? Or, failing that, maybe a really
simple fix?)
Anyways, I've been able to reproduce this problem with this script, so
maybe others can also. (Fortunately, I've been getting good at finding
other ways of isolating problems...)
Thanks,
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm