cmat ← {boxstyle} ##.display array          ⍝ Boxed display of array.

The argument is displayed with a series of boxes bordering each sub-array. Char-
acters embedded in the borders indicate sub-array shape and type.

Shape:  ↓ → Non-zero axis. 
        ⌽ ⊖ Zero axis.

Type:     ∊ Nested array.
          ~ Numeric.
          - Character.
          # Namespace reference.
          ∇ ⎕OR object.
          + Mixed type.

Prototypical items of empty arrays (⌽ ⊖) are exposed.

With  one  exception,  [display] perfectly distinguishes arrays. That is to say,
distinct  arrays  have distinct display forms. The exception, signalled by a '+'
character  in  its  left  lower border, is a depth-1 (sub) array containing both
characters and numbers. For example: display 88,'99'.

The  optional  left argument (default 1) selects the character set for the boxes
that enclose sub-arrays:
                                            ┌───┐
1 selects "smooth" line-drawing characters: │   │ and
                               .---.        └───┘
0 selects "clunky" characters: |   | which are easier to print.
                               '---'

Examples:

      display 'ABC'(1 4⍴1 2 3 4)(0 1 0⍴0)(⎕SE #)('88',99)
┌→────────────────────────────────────────┐ 
│ ┌→──┐ ┌→──────┐ ┌┌⊖┐ ┌→───────┐ ┌→────┐ │ 
│ │ABC│ ↓1 2 3 4│ ⌽↓0│ │ ⎕SE  # │ │88 99│ │
│ └───┘ └~──────┘ └└~┘ └#───────┘ └+────┘ │
└∊────────────────────────────────────────┘

      0 1 display¨'clunky' 'smooth'
 .→-----.  ┌→─────┐ 
 |clunky|  │smooth│
 '------'  └──────┘

See also: disp box

Back to: contents

Back to: Dyalog APL

Trouble seeing APL font?