## Vector Notation

If an expression contains one or more arrays, then the resultant vector will contain elements which are those arrays. The way in which this type of expression is constructed is known as 'vector notation'. Parentheses or quote characters are used to delimit arrays in vector notation. Alternatively, the expression may contain variable names.

                 'ABC' 'DEF'             (Two three element character vectors make
            ABC DEF                       a two element nested vector)

                 (1 2 3) 'DEF'           (Three element numeric and three element
            1 2 3  DEF                    character vector make a two element nested
                                          vector)
                 ½1 2 3 'DEF'            (Three numeric scalars and a three element
           4                              character vector make a four element vector)
                 ½(1 2 3) 'DEF'          (The parentheses force the three numbers
           2                              to be treated as the first element of the
                                          two element result)
                 ½1 2 3 'D' 'E' 'F'      (Each character is now treated as a scalar
           6                              giving a 6 element mixed result)
                 ((1 2) (3 4)) 2 3       (First element of the vector is itself
            1 2  3 4  2 3                 a nested vector - two two element numeric
                                          vectors. The ŒDISPLAY function clarifies:)
                 ŒDISPLAY ((1 2)(3 4))2 3
           .…---------------------------.
           | .…-------------.           |
           | | .…--.  .…--. |   2    3  |
           | | |1 2|  |3 4| |           |
           | | '~--'  '~--' |           |
           | '¹-------------'           |
           '¹---------------------------'

                 X„2 2½¼4                (Two row, two column numeric matrix)
                 Y„'HELLO'               (Five element character vector)
                 X Y                     (Variables entered in vector form)
            1 2   HELLO
            3 4
                 ½X Y                    (Shape 2)
           2

Topic: APLX Help : Help on APL language : APL Fundamentals : Vector notation

[ Previous | Next |Contents | Index ]