Nested array: Difference between revisions
m (Text replacement - "<source" to "<syntaxhighlight") Tags: Mobile edit Mobile web edit |
m (Text replacement - "</source>" to "</syntaxhighlight>") |
||
Line 5: | Line 5: | ||
A nested array is a kind of [[pointer array]] and is almost always stored using pointers. | A nested array is a kind of [[pointer array]] and is almost always stored using pointers. | ||
The result of [[Enclose]] on an array other than a [[simple scalar]] is always a nested array. The [[Dyalog APL]] primitive [[Nest]] (<syntaxhighlight lang=apl inline>⊆</ | The result of [[Enclose]] on an array other than a [[simple scalar]] is always a nested array. The [[Dyalog APL]] primitive [[Nest]] (<syntaxhighlight lang=apl inline>⊆</syntaxhighlight>), which encloses a [[simple]] argument, is named for this property: it applies the smallest transformation to turn the argument (unless it is a simple scalar) into a nested array. | ||
== See also == | == See also == |
Latest revision as of 22:01, 10 September 2022
In nested array theory, a nested array is an array of depth greater than one, that is, an array that contains at least one element which is not a simple scalar. It is roughly equivalent to a boxed array in flat array theory; more precisely, non-mixed nested arrays correspond exactly to boxed arrays. Depending on language, an empty array may never be considered nested, or it may be considered nested if its prototype is nested.
Scalar functions descend into nested arrays one element at a time. Arrays can be nested at an arbitrary depth so this descent constitutes a traversal. Nested arrays form a tree structure with some additional information (the shape) at each node.
A nested array is a kind of pointer array and is almost always stored using pointers.
The result of Enclose on an array other than a simple scalar is always a nested array. The Dyalog APL primitive Nest (⊆
), which encloses a simple argument, is named for this property: it applies the smallest transformation to turn the argument (unless it is a simple scalar) into a nested array.
See also
- NARS, the first commercial nested APL implementation.
APL features [edit] | |
---|---|
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 ∙ Array ordering (Total) ∙ Tacit programming (Function composition, Close composition) ∙ Glyph ∙ Leading axis theory ∙ Major cell search ∙ First-class function |
Errors | LIMIT ERROR ∙ RANK ERROR ∙ SYNTAX ERROR ∙ DOMAIN ERROR ∙ LENGTH ERROR ∙ INDEX ERROR ∙ VALUE ERROR ∙ EVOLUTION ERROR |