Topic: APLX Help : Help on APL language : APL Fundamentals : Display of arrays
[ Previous | Next | Contents | Index | APL Home ]

Display of arrays

Display of simple, numeric arrays

By default, numeric data is displayed with a space between each successive element of a vector (or dimension in an array). Arrays are displayed in such a way that their structure should be apparent. Vectors are displayed as a line of data. Matrices are displayed with each row of the matrix on successive lines of the screen or printer. For arrays of higher rank, the display is by means of successive matrices. Successive planes are separated by one blank line, successive blocks by two blank lines and so on.

An empty vector displays as one blank line. Empty arrays of rank 2 or more are not displayed.

Display of simple, character arrays

These are displayed without spaces between elements on the row; other rules are the same as those for simple numeric arrays.

Display of simple, mixed arrays

The rules described above apply to simple arrays which are all character or all numeric. Simple, mixed arrays make use of the rule that a column which contains a number is always separated from adjacent columns by at least one blank.

             MAT                     (Simple, mixed array, note columns are
        A B   45 C                    separated by spaces)
        D 999 F  1000
             2 4⍴'ABCDEFGH'          (Simple character array - columns not
       ABCD                           separated)

Display of a class or object reference

By default, APLX displays an object reference as the unqualified class name contained in square brackets. Class references are displayed as the class name in curly braces:

        Queue                     ⍝ User-defined APL class
        {Queue}                   ⍝ Default display of class reference
              QUEUE23←⎕NEW Queue 
              QUEUE23             ⍝ Default display of APL object reference

You can change the default display for an object by using the ⎕DF system method.

Display of nested arrays

The display of any nested array is preceded by a leading blank so that nested arrays will be indented one space. It is also followed by a trailing blank.

             ⍳5                      (Simple vector)
       1 2 3 4 5
             (⍳3) (⍳2)               (Nested vector indented by one space)
        1 2 3  1 2

The other rules for the display of nested arrays are:

  • At least one blank between columns with numbers
  • No separation between columns with scalar characters
  • Numbers right justified on the decimal point
  • Character vectors (containing only scalars) left justified
  • Columns with text and numbers right justified
  • Other nested items displayed with leading and trailing blank for each level of nesting.

For example:

             2 3⍴'ABC' 100027 'NAME' 3 'DAT' 27
        ABC 100027 NAME
          3    DAT   27
             3 2⍴'JOHN' 'SMITH' 'ARTHUR' 'JONES' 'WILFRED' 'HART'
        JOHN    SMITH

Topic: APLX Help : Help on APL language : APL Fundamentals : Display of arrays
[ Previous | Next | Contents | Index | APL Home ]