Comparison of programming languages (array)
This comparison of programming languages (array) compares the features of array data structures or matrix processing for various computer programming languages.

Syntax

Array dimensions 

The following list contains syntax examples of how to determine the dimensions (index of the first element, the last element or the size in elements).

Note particularly that some languages index from zero while others index from one.  At least since Dijkstra's famous essay, zero-based indexing has been seen as superior, and new languages tend to use it.

Indexing 

The following list contains syntax examples of how to access a single element of an array.

Slicing

The following list contains syntax examples of how a range of element of an array can be accessed.

In the following table:
 - the index of the first element in the slice
 - the index of the last element in the slice
 - one more than the index of last element in the slice
 - the length of the slice (= end - first)
 - the number of array elements in each (default 1)

Array system cross-reference list

Vectorized array operations 

Some compiled languages such as Ada and Fortran, and some scripting languages such as IDL, MATLAB, and S-Lang, have native support for vectorized operations on arrays.  For example, to perform an element by element sum of two arrays,  and  to produce a third , it is only necessary to write
  c = a + b

In addition to support for vectorized arithmetic and relational operations, these languages also vectorize common mathematical functions such as sine. For example, if  is an array, then
  y = sin (x)

will result in an array  whose elements are sine of the corresponding elements of the array .

Vectorized index operations are also supported.  As an example,
 even = x(2::2);
 odd = x(::2);
is how one would use Fortran to create arrays from the even and odd entries of an array.  Another common use of vectorized indices is a filtering operation.  Consider a clipping operation of a sine wave where amplitudes larger than 0.5 are to be set to 0.5.  Using S-Lang, this can be done by
  y = sin(x);
  y[where(abs(y)>0.5)] = 0.5;

Mathematical matrix operations

References 

Programming language comparison
Array