Next: Curly Braces, Previous: zoom, Up: Internal Routines [Contents][Index]

`[ `

`x` [, `y` …] ]

Concatenation of scalars, strings, or arrays (numerical or string).
With a single argument, `[]`

returns that argument with one more
dimension (equal to 1) appended at the high end. Scalars get upgraded
to numerical arrays, strings to string arrays.

With more than one argument, with not all of them undefined, and with
the defined ones either all numerical or all of string types, `[]`

concatenates the arguments. The concatenation happens in the last
dimension. If `n`

is the greatest number of dimensions in any of
the defined arguments, then all defined arguments must have either
`n`

or `n - 1`

dimensions (scalars and strings count as having
zero dimensions), and each of the first `n - 1`

dimensions must
have the same size in all arguments. The result will have `n`

dimensions. The first `n - 1`

dimensions will be the same as those
in all of the defined arguments, and the `n`

th dimension will be
equal to the sum of the `n`

th dimensions of all arguments (with
`n - 1`

-dimensional arguments each adding one and undefined
arguments adding none).

Undefined arguments are ignored (if at least one argument has a value), so you can construct an array one element at a time in a loop without needing to seed the array with a dummy element, or needing to replicate the inside of a loop separately for the first element of the array. For example:

delete,x do x = [x, more_elements()] while condition

Alias: concat

See also: Combining Arrays

Next: Curly Braces, Previous: zoom, Up: Internal Routines [Contents][Index]