>>  <<  Ndx  Usr  Pri  Phr  Dic  Rel  Voc  !:  wd  Help  Dictionary

Debug 13!:

See Section II.J and the script system\main\debug.ijs.

13!:0 y Reset. Reset stack and disable (0) or enable (1) suspension. Nearly all the facilities in the 13!: family require that suspension enabled; all the examples below assume that suspension is enabled: 13!:0 ]1
 
13!:1 y Display Stack. See also 13!:18.
 
13!:2 y Query Stops.
 
13!:3 y Set Stops. Explicit stops are requested by name and line number in the argument y, which contains zero or more stop specifications separated by semicolons. Each stop specification indicates a name, line numbers (if any) for the monadic case, a colon, and line numbers (if any) for the dyadic case. An asterisk indicates "all", and a tilde indicates "except for". For example:
13!:3 'f 0' f monadic line 0
13!:3 'f :2' f dyadic line 2
13!:3 'f 0 2:1' f monadic 0 2, dyadic 1
13!:3 'f 0; g :*' f monadic 0 and g all dyadic
13!:3 '* 0:0' monadic 0 and dyadic 0
13!:3 'a* *:*; ~ab* *:*'   All monadic and dyadic whose names begin with a, except for any beginning with ab
   f=: 3 : 0
10
11
:
20
)
   13!:3 'f 1:0'               Stop at f monad line 1, dyad line 0
   f ''
|stop: f
|       11
|f[1]
      13!:0 ]1                 Clear stack and enable suspension
   3 f 4
|stop: f
|       20
|f[:0]
13!:4 y Run Again. Resume execution at the current line. For example:
   g=: 3 : ('t=. 2*y.'; '1+t')
   3 4,g 'abc'
|domain error: g
|   t=.2    *y.
|g[0]
      y.                       six-space indent indicates suspension
abc                            Local value of y.
      y.=. 25                  Redefine local value of y.
      13!:4 ''                 Run again
3 4 51
13!:5 y Run Next. Resume execution at the next line. For example:
   h=: 3 : ('t=. 2 3*y.'; '1+t')
   3 4,h 5 6 7
|length error: h
|   t=.2 3    *y.
|h[0]
      t=. 99                   six-space indent indicates suspension
      13!:5 ''                 Run next
3 4 100
13!:6 y Exit and Return. Exit the verb/adverb/conjunction at the top of the stack, returning result y . For example:
   g=: 3 : ('t=. 2*y.'; '1+t')
   3 4,g 'abc'
|domain error: g
|   t=.2    *y.
|g[0]
      13!:6 [9                 Exit g with result 9
3 4 9
   h=: 2&*
   3 4,h 'abc'
|domain error: h
|h[0]
      13!:6 [97                Exit h with result 97
3 4 97
13!:7 y Continue. Resume execution at line number y
 
[x] 13!:8 y Signal. Signal error number {.,y (see 9!:8) with optional text x
 
[x] 13!:9 y Rerun. Resume execution by rerunning the verb/adverb/conjunction on the top of the stack with the specified arguments. Thus:
   plus=: +
   plus/'abc'
|domain error: plus
|plus[:0]
      13!:13 ''                See below re interpretation of stack
+----+-+-+-+-++-----+--+
|plus|3|0|3|+||+-+-+|  |
|    | | | | |||b|c||  |
|    | | | | ||+-+-+|  |
+----+-+-+-+-++-----+--+
      2 (13!:9) 3              Rerun, getting another error
|domain error: plus
|plus[:0]
      13!:13 ''                Note left and right args ('a' and 5)
+----+-+-+-+-++-----+--+
|plus|3|0|3|+||+-+-+|  |
|    | | | | |||a|5||  |
|    | | | | ||+-+-+|  |
+----+-+-+-+-++-----+--+
      1 (13!:9) 5              Rerun 
6
[x]13!:10 y Rerun Execute. Rerun with specified executed arguments
 
13!:11 y Error Number. Last error number
 
13!:12 y Error Message. Last error message
 
13!:13 y Stack. If suspension is enabled, 13!:13 '' produces an 8-column matrix of information on the verbs/adverbs/conjunctions on the stack:

0  Name
1Error number or 0 if not in error
2Line number
3Name class: 3, 1, or 2, denoting verb, adverb, or conjunction
4Linear representation of the entity
5The name of the defining script
6Argument(s) individually boxed
7Locals as a 2-column matrix of name and value

In the last two columns, nouns are included per se, and verb, adverb, and conjunction are represented by linear forms. For example:
   mean=: sum % #
   sum=: plus/
   plus=: 4 : 'x.+y.'
   mean 'abcd'
|domain error: plus
|   x.    +y.
|plus[:0]

      13!:13 ''                Note tacit definitions have no locals
+----+-+-+-+-----------++------+------+
|plus|3|0|3|4 : 'x.+y.'||+-+-+ |+--+-+|
|    | | | |           |||c|d| ||x.|c||
|    | | | |           ||+-+-+ |+--+-+|
|    | | | |           ||      ||y.|d||
|    | | | |           ||      |+--+-+|
+----+-+-+-+-----------++------+------+
|sum |0|0|3|plus/      ||+----+|      |
|    | | | |           |||abcd||      |
|    | | | |           ||+----+|      |
+----+-+-+-+-----------++------+------+
|mean|0|0|3|sum % #    ||+----+|      |
|    | | | |           |||abcd||      |
|    | | | |           ||+----+|      |
+----+-+-+-+-----------++------+------+
13!:14 y Query Latent Expression.
 
13!:15 y Set Latent Expression. The latent expression is executed when execution is about to be suspended; error messages are suppressed; any continuation must be programmed in the latent expression.
 
13!:16 y Trace. See below.
 
13!:17 y Query. Is suspension enabled? (Set by 13!:0)
 
13!:18 y Stack Text. Like 13!:1, but gives the stack as a literal matrix.



The conjunction 13!:16 controls tracing.
u     13!:16 n
(r,c) 13!:16 n
The right argument n specifies the maximum level of function call to be traced: 0 means no trace; 1 means immediate execution only; _ means trace everything; etc. The left argument can be a verb to be used for displaying arrays in the trace (and is not itself traced during tracing). It may also be integers r,c, whence the system default display is used, clipped to r rows and c columns. (Two numbers suffice as clipping parameters because the output of an n-dimensional array is 2-dimensional on the screen.) Finally, it may be the empty vector, whence the current trace level and display controls are shown. The result is i.0 0. For example:

trace=: 13!:16
lr =: 3 : '5!:5<''y.'''   Linear display of an array
_ _ trace _ Trace everything; display everything
9 trace 1 Trace immediate execution only; display maximum of 9 rows
": trace n Same as _ _ trace n
lr trace n Linear display of trace output

Tracing provides information on results within a line; the action labels 0 monad, 1 monad, 9 paren, etc., are from the parse table in Section II.E, and reflect the activities of the interpreter with high fidelity.
   _ _ (13!:16) _                    Trace everything; display everything

   i.4                               input sentence
 --------------- 0 monad ------      action
 i.                                  verb
 4                                   argument
 0 1 2 3                             result
 ==============================      end of parse
0 1 2 3                              result of input sentence

   (i.2 4) +/ .* *: 5 * 10 20 30 40  input sentence
 --------------- 2 dyad -------
 5                                   left argument
 *                                   verb
 10 20 30 40                         right argument
 50 100 150 200                      result
 --------------- 0 monad ------
 i.                                  verb
 2 4                                 argument
 0 1 2 3                             |result
 4 5 6 7                             |
 --------------- 9 paren ------
 0 1 2 3
 4 5 6 7
 --------------- 3 adverb -----
 +
 /
 +/
 --------------- 4 conj -------
 +/
  .
 *
 +/ .*
 --------------- 1 monad ------      Words to the left of *: are parsed
 *:                                  first because an operator may "grab"
 50 100 150 200                      a verb.
 2500 10000 22500 40000
 --------------- 2 dyad -------
 0 1 2 3                             |left argument
 4 5 6 7                             |
 +/ .*                               verb
 2500 10000 22500 40000              right argument
 175000 475000                       result
 ==============================      end of parse
175000 475000                        result of input sentence



>>  <<  Ndx  Usr  Pri  Phr  Dic  Rel  Voc  !:  wd  Help  Dictionary