>> << 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 be enabled; all the examples below assume that suspension is enabled:`13!:0 ]1` . Only named definitions (verb, adverb, or conjunction) can be suspended.
`13!:1 y` | Display Stack. Only named definitions (verb, adverb, or conjunction) are put on the stack. See also`13!:13` and`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` (an integer between 1 and 255) with optional text`x`

`[x] 13!:9 y`

Rerun. Resume execution by rerunning the tacit verb at 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

`13!:11 y` | Error Number. Last error number
`13!:12 y` | Error Message. Last error message

`13!:13 y`

Stack. Produces a 9-column matrix of information on the (named) verbs/adverbs/conjunctions on the stack:

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

In columns 6 and 7, nouns are included per se, and verb, adverb, and conjunction are represented by their linear representation. 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.

A debug suspension is an immediate execution state with a non-empty execution stack. Another debug suspension is created when a named object (verb, adverb, or conjunction) is invoked in a debug suspension and it too suspends.

Four verbs are provided. They are part of the debug facility in the J development environment and usually are not invoked directly. Their behaviour and availability are subject to change without notice.

`13!:19 y` | Cut Back. Cut back one stack level, stopping at the line at the next stack level.
`[x] 13!:20 y` | Step Over. Run the current line (or line`x` if specified) to completion, stopping at the next line.
`[x] 13!:21 y` | Step Into. Run the current line (or line`x` if specified), stopping at the next line.
`[x] 13!:22 y` | Step Out. Run the current object to completion, starting with the current line (or line`x` if specified), stopping at the next line.

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                             |
     --------------- 8 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