## ̃ Index

The ̃ ('index') function selects from the array which forms its right argument according to the index array formed as its left argument. The left argument cannot be of depth greater than 2. Each element in the left argument addresses successive dimensions of the right argument and multiple index selections may be formed by creating a suitably nested vector. The dimensions specified in the left argument are used in the same order as with the ½ function, that is columns last, preceded by rows and so on. Index is affected by the Index Origin (ŒIO).

                 2 ̃ 1 2 3 4 5           (Scalar for vector indexing - only one
           2                              dimension)
                 (›3 4)̃ 1 2 3 4 5       (Nested scalar for multiple index)
           3 4
                 TAB„2 5½¼10
                 TAB
           1  2  3  4  5
           6  7  8  9 10
                 2 3 ̃ TAB
           8
                 2 (2 3)̃ TAB            (Second element of the indexing vector
           7 8                            is the enclosed vector 2 3)
                 (1 2) (2 3)̃TAB         (Nested 2 element vector for multiple
           2 3                            index. Result is rows 1 2 and columns
           7 8                            2 3)

If the index function is given an empty left argument, and a scalar right argument, it will return the scalar as the result.

                 (¼0)̃37
           37

### Index with axis

Index can be used with an axis specification. In this case the left argument only applies to those axes specified. Other axes are not indexed.

                 2̃[1]TAB                (Select the second member of the first
           6 7 8 9 10                     dimension - the rows)
                 (›2 3)̃[2]TAB           (Select the second and third members of the
           2 3                            second dimension - the columns)
           7 8

Topic: APLX Help : Help on APL language : APL Primitives : ̃ Index

[ Previous | Next | Contents | Index ]