In the flat array model, a box is a scalar value which "contains" a single arbitrary array. This array can be obtained by unboxing the box, and any array can be enclosed in a box using the Box, or Enclose, function. A box corresponds to the nested array theory concept of an enclosed array, and an array of boxes (a "boxed array") to a nested array.
Boxes are one of three possible types for array elements in most flat array languages, the other two being character and numeric data. Because they can store any array, boxes may be used to define arrays which contain both numbers and characters, as well as arrays with a nested structure.
The Equals and Not Equals functions compare boxes (as scalar functions, they apply only to individual boxes) by comparing whether the contained arrays match. Other scalar functions usually give a DOMAIN ERROR when passed boxed arguments; this differs from the nested array convention of recursing into nested arrays. Because of this behavior scalar functions in nested APLs are said to be pervasive while those in flat APLs are not.
Simple scalars in nested array languages float, so that an enclosed simple scalar is equal to that simple scalar. In flat APLs this does not happen: boxing an array always results in a different array which has one greater depth.
|APL features |
|Built-ins||Primitives (functions, operators) ∙ Quad name|
|Array model||Shape ∙ Rank ∙ Depth ∙ Bound ∙ Index (Indexing) ∙ Axis ∙ Ravel ∙ Ravel order ∙ Element ∙ Scalar ∙ Vector ∙ Matrix ∙ Simple scalar ∙ Simple array ∙ Nested array ∙ Cell ∙ Major cell ∙ Subarray ∙ Empty array ∙ Prototype|
|Data types||Number (Boolean, Complex number) ∙ Character (String) ∙ Box ∙ Namespace ∙ Function array|
|Concepts and paradigms||Conformability (Scalar extension, Leading axis agreement) ∙ Scalar function (Pervasion) ∙ Identity element ∙ Complex floor ∙ Total array ordering ∙ Tacit programming (Function composition, Close composition) ∙ Glyph|
|Errors||LIMIT ERROR ∙ RANK ERROR ∙ SYNTAX ERROR ∙ DOMAIN ERROR ∙ LENGTH ERROR ∙ INDEX ERROR ∙ VALUE ERROR|