Ravel

In the APL array model, an array's ravel is the vector containing all its elements in ravel order. The Ravel function, which was introduced in APL\360 and is universally spelled, returns the ravel of an array. It is equivalent to reshaping an array using its bound for the new shape. Reshaping the ravel using the original array's shape restores that array.

In some APLs an axis may be specified for Ravel in order to combine only some axes of an array, or insert a length-1 axis.

The name "ravel" references the process of undoing woven or knitted fabric, thus removing its structure and rendering it linear.

Examples
You can use ravel to squash a matrix down to one dimension. The elements are listed in reading order—left to right, top to bottom.

Ravelling a scalar yields a singleton vector.

String notation cannot produce a single-character string since it produces a scalar character instead. Using Ravel on a list of characters in quotes ensures it will be a vector of characters.

Axis specification may accept either a vector of two or more adjacent axis indices, or a single non-integer value. If multiple axes are given, they are merged into one axis whose length is the product of their lengths. If only one value is given, a new axis of length 1 is inserted in the indicated "gap" between axes.

Description
The ravel of an array  has shape   and shares elements with. Thus Ravel may be modelled as a reshaping function. The element with index vector  is moved to index   in index origin 0, or   in arbitrary index origin.

As with any reshaping, the result of Ravel has the same prototype as the argument.

History
Ravel was present in the first version of APL\360 and has been included in every APL since.

Documentation
Dyalog with axis

J Dictionary, NuVoc

Other Resources
APL Cultivation