Fill element

From APL Wiki
(Redirected from Fill)
Jump to navigation Jump to search

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.


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

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

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


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