# Box

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 [edit]
| |
---|---|

Syntax | Array ∙ Function ∙ Operator ∙ Assignment |

Built-ins | Primitive function ∙ Primitive operator ∙ Quad name |

Array model | Shape ∙ Rank ∙ Depth ∙ Bound ∙ Index ∙ Axis ∙ Ravel ∙ Ravel order ∙ Element ∙ Scalar ∙ Vector ∙ Matrix ∙ Simple scalar ∙ Simple array ∙ Nested array ∙ Box ∙ Cell ∙ Major cell ∙ Subarray ∙ Empty array ∙ Prototype |

User definition | Tradfn ∙ Dfn ∙ Tacit |

Concepts and paradigms | Leading axis theory ∙ Scalar extension ∙ Conformability ∙ Scalar function ∙ Glyph ∙ Identity element |

Errors | LIMIT ERROR ∙ RANK ERROR |