12.07.2015 Views

Programmer's Guide & Language Reference - Dyalog Limited

Programmer's Guide & Language Reference - Dyalog Limited

Programmer's Guide & Language Reference - Dyalog Limited

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 1: Introduction 4ArraysA <strong>Dyalog</strong> APL data structure is called an array. An array is a rectangular arrangementof items, each of which may be a single number, a single character, a namespacereference (ref), another array, or the ⎕OR of an object. An array which is part ofanother array is also known as a subarray.An array has two properties; structure and data type. Structure is identified by rank,shape, and depth.RankAn array may have 0 or more axes or dimensions. The number of axes of an array isknown as its rank. <strong>Dyalog</strong> APL supports arrays with a maximum of 15 axes.• An array with 0 axes (rank 0) is called a scalar.• An array with 1 axis (rank 1) is called a vector.• An array with 2 axes (rank 2) is called a matrix.• An array with more than 2 axes is called a multi-dimensional array.ShapeEach axis of an array may contain zero or more items. The number of items alongeach axis of an array is called its shape. The shape of an array is itself a vector. Itsfirst item is the length of the first axis, its second item the length of the second axis,and so on. An array, whose length along one or more axes is zero, is called an emptyarray.DepthAn array whose items are all simple scalars (i.e. single numbers, characters or refs) iscalled a simple array. If one or more items of an array is not a simple scalar (i.e. isanother array, or a ⎕OR), the array is called a nested array. A nested array may containitems which are themselves nested arrays. The degree of nesting of an array iscalled its depth. A simple scalar has a depth of 0. A simple vector, matrix, or multidimensionalarray has depth 1. An array whose items are all depth 1 subarrays hasdepth 2; one whose items are all depth 2 subarrays has depth 3, and so forth.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!