In other words, is it possible to trace functions in a script by placing a
verb inside explicitly defined verbs that will report that verb's name and
maybe its arguments (like the way that the utility `trace` reports)?
--
(B=)
--
I think so:
ownName=: 3 : 0
13!:13 ''
)
ownName ''
+---+-+-+-+++--++-+
|ownName|0|0|3|3 : ' 13!:13 '||++|+-++| |
| | | | |||y||| |
| | | | |||++|+-++| |
+---+-+-+-+++--++-+
Devon,
I get slightly different results.
13!:13 produces nothing, but 13!:1 produces the name and y arg prepended
with `'|`
which may work for me. The number of spaces is a little unpredictable, so
far, and I have not found a way to clean it up.
Below is a session example.
Thanks,
ownName=
13!:1 is defined only when debug is enabled. Don't rely on its behavior
when debug is off.
Henry Rich
On 8/4/2020 4:46 PM, Brian Schott wrote:
Devon,
I get slightly different results.
13!:13 produces nothing, but 13!:1 produces the name and y arg prepended
with `'|`
which may work for me
Henry,
Turning on debug helps (dbr 1). Thanks.
Or were you also warning me about how the 13!:13 outcome was missing?
I am trying to determine what is triggering some `gl_paint''`s before I am
ready for them, in an opengl control environment which has a_run and
a_g_paint and a_g_initialize and othe
For more clarity, the session below shows the improvement after enabling
debug.
load 'debug'
dbr 1
ownName 9
9
|ownName[0]
| ownName 9
--
For information about J forums see http://www.jsoftware.com/forums.htm
I cannot reproduce this result using the definition of ownName
provided in this thread. So I am guessing you are using a different
definition.
I would recommend something like this:
parentName=: 3 : 0
;{.,}.13!:13 ''
)
ownName=: 3 :0
echo parentName ''
)
Which behaves like this:
ownNam
Another option which does not require debug to be on is to embed the verb in a
try. catch. end. control block
tracer=: 4 : 0
try. x + y
catch. 2 3 $ 'x arg';'Error Type';'y arg'; x;(, 13!:12 '');y end.
)
4 tracer 5
9
4 tracer 'a'
┌─┬──┬─┐
│x arg│E
Bob's idea is better than mine. Since I always have debug on, I did not
notice the absence of a result from 13!:13.
ownNameRT=: 3 : 0
rr=. a:
try. rr+1 NB. Cause error
catch. rr=. }:([}.~2+':'i.~])>{.<;._1]13!:12 '' end.
rr
)
ownNameRT ''
ownNameRT
dbr 0
ownNameRT ''
ownName
13!:0 also resets the stack.
--
Raul
On Tue, Aug 4, 2020 at 9:49 PM Devon McCormick wrote:
>
> Bob's idea is better than mine. Since I always have debug on, I did not
> notice the absence of a result from 13!:13.
> ownNameRT=: 3 : 0
>rr=. a:
>try. rr+1 NB. Cause error
>catch. rr=
I have little routine to plot a compass circle and a line showing the
heading to a radio source. I want to plot the letters N, E, S, W and a
legend giving the distance to the source. Here's a bit of the code:
xc=. }: 1p1*int01 2000
sx=. 0.85*sin xc
cx=. 0.85*cos xc
pd 'reset'
pd options
pd 'tit
11 matches
Mail list logo