5!: Representation

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

Representation | 5!:

`x 5!:0` | Define.`5!:0` is an adverb and provides a complete inverse of`5!:1`.`` That is,`(5!:1 <'f') 5!:0` equals`f` for all`f` .
`5!:1 y` | Atomic. The atomic representation of the entity named`y` and is used in gerunds. The result is a single box containing a character list of the symbol (if primitive) or a two-element boxed list of the symbol and atomic representation of the arguments (if not primitive). Symbol-less entities are assigned the following encodings: `0` Noun `2` Hook `3` Fork `4` Bonded conjunction `7` Defined operator (pro-adverb or pro-conjunction) For example:
       plus=: +
       5!:1 <'plus'
    +-+
    |+|
    +-+
       noun=: 3 1 4 1 5 9
       5!:1 <'noun'
    +---------------+
    |+-+-----------+|
    ||0|3 1 4 1 5 9||
    |+-+-----------+|
    +---------------+
       increment=: 1&+
       5!:1 <'increment'
    +-------------+
    |+-+---------+|
    ||&|+-----+-+||
    || ||+-+-+|+|||
    || |||0|1|| |||
    || ||+-+-+| |||
    || |+-----+-+||
    |+-+---------+|
    +-------------+
`5!:2 y` | Boxed.
       nub=: (i.@# = i.~) # ]
       5!:2 <'nub'
    +-------------------+-+-+
    |+--------+-+------+|#|]|
    ||+--+-+-+|=|+--+-+|| | |
    |||i.|@|#|| ||i.|~||| | |
    ||+--+-+-+| |+--+-+|| | |
    |+--------+-+------+| | |
    +-------------------+-+-+
`5!:4 y` | Tree. A literal matrix that represents the named entity in tree form. Thus:
       5!:4 <'nub'
                +- i.
          +- @ -+- #
      +---+- =
      |   +- ~ --- i.
    --+- #
      +- ]
`5!:5 y` | Linear. The linear representation is a string which, when interpreted, produces the named object. For example:
       5!:5 <'nub'
    (i.@# = i.~) # ]

       5!:5 <'a' [ a=: o. i. 3 4
    3.14159265358979324*i.3 4

       lr=: 3 : '5!:5 <''y.'''
       lr 10000$'x'
    10000$'x'
`5!:6 y` | Paren. Like the linear representation, but is fully parenthesized.
       5!:6 <'nub'
    ((i.@#) = (i.~)) # ]
`x 5!:7 y` | Explicit. The left argument is 1 (monadic) or 2 (dyadic); the right argument is the boxed name of a verb, adverb, or conjunction. For example:
       perm=: 3 : 0
        z=. i.1 0
        for. i.y. do. z=.,/(0,.1+z){"2 1\:"1=i.>:{:$z end.
       )

       1 (5!:7) <'perm'
    +-+----------+-------------------------------+
    |0|1 _1 0    |z=.i.1 0                       |
    +-+----------+-------------------------------+
    |1|65536 2 1 |for.                           |
    +-+----------+-------------------------------+
    |2|2 _1 1    |i.y.                           |
    +-+----------+-------------------------------+
    |3|131072 6 1|do.                            |
    +-+----------+-------------------------------+
    |4|1 _1 1    |z=.,/(0,.1+z){"2 1\:"1=i.>:{:$z|
    +-+----------+-------------------------------+
    |5|32 3 1    |end.                           |
    +-+----------+-------------------------------+
The result of`5!:7` is a 3-column boxed matrix. Column 0 are the boxed integers`0 1 2 ... n-1`. Column 1 are boxed 3-element integer vectors of control information: control word code, goto line number, and source line number. Column 2 are boxed control words and sentences. The result of`5!:7` is a`0 3` empty matrix if the named object is not an explicit definition, or is undefined for the specified valence.

For all but the noun case, the default displays established by`9!:3` provide convenient experimentation with all representations. For example,`9!:3 (6 4 2)` specifies that the paren, tree, and boxed representations are all to be displayed.

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