OK - so I found a get-round for tracing through a function (as reported
below),
but I'm sorry to say here's another glitch.
If a named, defined function throws an error, trying to capture the
behaviour
with debug invoked by ctrl-K doesn't work, for me, at least:
I define a toy function, "test," with a deliberate bug, in the do.
statement and run it:
test =: 3 : 0
n =. y
q =. 1
for_i. i.% n do.
q =. q + 1
end.
q
)
test 3 NB. expected result with debug off
|domain error: test
| i.%n
Now I invoke debug with ctrl-K and run test 3 to inspect the error (!):
test 3 NB. after using ctrl-K to switch debug on
|index error: jdb_lexwin1
| mrg=.'>' CURRENTLINE}NUMLINES#' '
|jdb_lexwin1[6]
Nothing new is displayed in the debug display. Not terribly useful.
All this in JQt, Windows, J9.01 beta j, as reported previously (in
correspondence further below)
This experiment works fine in J8.07; I'm afraid I can't easily roll
back to previous
J9.01 betas.
Thanks again,
Mike
On 09/09/2019 18:06, 'Mike Day' via Beta wrote:
Thanks, Henry
Actually, I've just noticed something, that we can use as a get-around.
I often use my own timer function, which just reports the elapsed
clock-time.
Using ctrl-K with the function "test" and either choosing stop all
lines or stop
selected lines, and running test indirectly as a quoted function and
argument, eg
timer'test 3'
DOES display the function line by line as it should, and as it used to
do in a previous
incarnation of J.
I would have reported this for ts 'test 3' , where
ts =: 6!:2 , 7!:2@]
but the display then shows a single multiline as I reported previously.
However, the following is sufficient to achieve the required display:
monad : 'test y' 3
so I don't need to list my "timer" !
I expect this comes as no particular surprise in view of your thoughts
expressed below,
Cheers,
Mike
On 08/09/2019 17:40, Henry Rich wrote:
Looks like the stack frame created by 13!:13'' doesn't include the
local symbols, which makes the debugger think it's not an explicit
definition. I'll look into it.
Henry Rich
On 9/8/2019 11:45 AM, 'Mike Day' via Beta wrote:
A monadic function threw an error, so I used ctrl-K to invoke the
debugger,
and set stop all lines, expecting to be able to step through it to
see what
was happening.
Unfortunately, the lines were not displayed separately in the trace.
It's difficult to explain succinctly so here goes with a toy
function which
DOES work ok:
JVERSION
Engine: j901/j64avx/windows
Beta-j: commercial/2019-09-06T12:39:55
Library: 9.01.08
Qt IDE: 1.8.2/5.12.2
Platform: Win 64
Installer: J901 install
InstallPath: c:/d/j901
Contact: www.jsoftware.com
test
3 : 0
n =. y
q =. 1
for_i. i.n do.
q =. q + 1
end.
q
)
test 3 NB. use it without the debugger...
4
So far so good. I'll now do ctrl-K and set a stop on all lines, and
then run test 3 again:
test 3
...
now Debug shows this in the top window:
|>[0] 3 : 0[]n =. yq =. 1[]for_i. i.n do.[] q =. q +
1[]end.[]q[])
please note the "[]" characters are my version of an APL-ish squish
I would expect to see something like:
>|[0] n =. y
|[1] q =. 1
|[2] for_i. i.n do.
|[3] q =. q + 1
|[4] end.
|[5] q
The middle window is similar:
stop
test[0] 3 : 0[]n =. yq =. 1[]for_i. i.n do.[] q =. q +
1[]end.[]q[])
I've seen this sort of unrewarding display previously, but for
adverbs and
conjunctions, or memoised functions, not for "simple" monads or
dyads.
This might not be a particular feature of Beta version j - I'm not sure
I've used debug in version i, but probably have in version h.
Thanks
Mike
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
---
This email has been checked for viruses by AVG.
https://www.avg.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm