Topic: `APLX Help` : `Help on APL language` : `APL Fundamentals` : `Vector notation`
[ Previous | Next |Contents | Index | APL Home ] # 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 | APL Home ]