152
TRACE
AND
STOP
CONTROLS
APL provides
the
ability
to
trace or
stop
execution
of
user-defined functions, pro-
viding
the
functions are
not
locked (see Locked Functions
in
this chapter).
Trace Control
Trace control
is
used
to
display
the
results of selected
statements
as
a function
executes. The display consists
of
the
function name followed by
the
number and
results
of
the
selected
statement.
For example:
~STEVE[1]
2 • Result
Function "
Statement
Name Name
Statements
to
be traced are specified by a trace vector. The
format
of
the
trace
control function
is
T
D,
STEVE+-V, where STEVE
is
the
name
of
the
function and
V
is
the
vector specifying
the
statement
numbers
to
be traced.
For
example, if
T
D,
STEVE+-2 3 5
is
entered,
the
statements 2,
3,
and 5 are traced each time
function
STEVE
is
executed. T
D,
STEVE+- 't 0 must be
entered
to
discontinue
the
tracing
of
function STEVE.
To
trace each
statement
of
the
function, enter
TD,
STEVE+-tN,
where N
is
the
number
of
statements
in
the
function:
'VSTEVE
I::
[]::I
'V.
V
STEVE
J
[:1.::1
Af·l
x:t:
[2]
B~"2xJ
[:'5]
C~"3x:t:
[1+]
[I~"L~xI
[~:;]
A+B+C+D
'f/
STEVE
2
20
TllSTEVE~"
\
1,1,
STEVE
2
STEVE[:I.:1 2
STEVEt::2]
1+
STEVE[3] 6
STEVE[LI,]
B
20
~Trace
the
first
four
statements
in
function STEVE.
TllSTEVEf-2
~"--Trace
statement
2
in
function STEVE.
STEVE
2
STEVE
I::
2:1
Lt,
20
20
TASTEVE
f-
\
()
-----Discontinue
tracing
in
function STEVE.
STEVE
2