J's debugger's behavior seems, to me, to be non-intuitive.
First off, I need some buggy code.
So, I've taken a simple routine to swap a pair of elements in
an array
swap=: ({~|.)`]`[}
'abcdef' swap 0 _1
fbcdea
and broken it
swap=: ({~|.)`{`[}
'abcdef' swap 0 _1
|domain error: swap
But, for the debugger to be useful, I need some more stuff
-- preferably verbs with explicit definitions. So:
NB. y is value
node=: <^:(1-L.)
addnode=:3 :0
heap=: heap addnode y
:
(x,node y) order #x
)
NB. y is index
parent=: <[EMAIL PROTECTED]:@<:
order=:3 :0
heap=: heap order y
:
if.1>y do.x return.end.
pair=.(,parent)y
if.(-:/:~)pair{x do.x return. end.
(x swap pair) order {:pair
)
heap=: '' NB. heap is x for dyads, global for monads
Now, I start up the debugger and watch my code break
addnode each 11 5 8 3 4 15
Problem 1: when I use the "Cut back" debugger icon, nothing
seems to happen. When I use it again, the stack has been
cut back 2 levels.
Problem 2: when I try to step back into the code, using the
"Step into" icon, I step twice and hit the index error:
I am never presented with the line which contains the reference
to the broken function.
In principle, I can work around this issue by setting breakpoints,
but that can get quite tedious to manage. (Another problem there
is that I have to know whether my breakpoints were set on the
individual line or on all lines to use the breakpoint manager to clear
those breakpoints. But mostly, it's just a lot of mouse clicks to
do a common operation.)
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm