Box

(Redirected from Boxes)

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 ShapeRankDepthBoundIndex (Indexing) ∙ AxisRavelRavel orderElementScalarVectorMatrixSimple scalarSimple arrayNested arrayCellMajor cellSubarrayEmpty arrayPrototype
Data types Number (Boolean, Complex number) ∙ Character (String) ∙ BoxNamespaceFunction array
Concepts and paradigms Conformability (Scalar extension, Leading axis agreement) ∙ Scalar function (Pervasion) ∙ Identity elementComplex floorArray ordering (Total) ∙ Tacit programming (Function composition, Close composition) ∙ GlyphLeading axis theoryMajor cell search
Errors LIMIT ERRORRANK ERRORSYNTAX ERRORDOMAIN ERRORLENGTH ERRORINDEX ERRORVALUE ERROREVOLUTION ERROR