Fill element: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
Miraheze>Marshall
No edit summary
(4 intermediate revisions by 3 users not shown)
Line 35: Line 35:
=== Documentation ===
=== Documentation ===


* [http://help.dyalog.com/latest/index.htm#Language/Primitive%20Functions/Fill%20Elements.htm Dyalog]
* [https://help.dyalog.com/latest/index.htm#Language/Introduction/Variables/Prototypes and Fill Items.htm Dyalog]
 
{{APL features}}[[Category:Function characteristics]]

Revision as of 23:10, 4 January 2021

A fill element is an element used for the result of a function when no element from the argument or another relevant array is used. The fill element is usually that array's prototype. J allows the fill to be specified using the fit conjunction !., an analogue of Variant.

Fills are one way to convert an empty array into a non-empty array. Reduction along an empty axis also produces such a transition, but in this case an identity element for the reducing function is used instead of a fill.

Uses

The following functions and operators may use fill elements in their results.

Glyph Monad Dyad
Reshape
Mix (or ) Take
/ and Replicate
\ and Expand
Rank operator
Key
Stencil

All functions except Mix derive fill elements from the argument's prototype. In Mix, each element of the argument is extended with fills from its own prototype.

Each operator in the table uses fills to force the results from its left operand to have a common shape—in one nested interpretation, they call Mix on an array with those results as elements. The fills for each result are taken from that result's prototype.

In languages with function rank, fills are similarly used to force result cells of a function with rank to have a uniform shape. This means that fills may be used by any primitive function which can produce differently-shaped result cells in a single application. A notable example is Unbox, which behaves like the nested Mix because of this feature of function rank.

External links

Documentation


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