Difference between revisions of "Nested array"

From APL Wiki
Jump to navigation Jump to search
Miraheze>Marshall
Miraheze>Adám Brudzewsky
m (Text replacement - "{{APL programming language}}" to "{{APL features}}")
Line 7: Line 7:
 
The result of [[Enclose]] on an array other than a [[simple scalar]] is always a nested array. The [[Dyalog APL]] primitive [[Nest]] (<source lang=apl inline>⊆</source>), which encloses a non-[[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.
 
The result of [[Enclose]] on an array other than a [[simple scalar]] is always a nested array. The [[Dyalog APL]] primitive [[Nest]] (<source lang=apl inline>⊆</source>), which encloses a non-[[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.
  
{{APL programming language}}
+
{{APL features}}

Revision as of 23:36, 16 November 2019

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 non-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.


APL features [edit]
Built-ins Primitive functionPrimitive operatorQuad name
Array model ShapeRankDepthBoundIndex (Indexing) ∙ AxisRavelRavel orderElementScalarVectorMatrixSimple scalarSimple arrayNested arrayCellMajor cellSubarrayEmpty arrayPrototype
Data types Number (Boolean, Complex number) ∙ Character (String) ∙ BoxNamespace
Concepts and paradigms Leading axis theoryScalar extensionConformabilityScalar functionPervasionGlyphIdentity elementComplex floorTotal array ordering
Errors LIMIT ERRORRANK ERRORSYNTAX ERRORDOMAIN ERRORLENGTH ERRORINDEX ERRORVALUE ERROR