Fill element: Difference between revisions
m (Text replacement - "<source" to "<syntaxhighlight") |
m (→Documentation: Encode spaces in URL) |
||
Line 35: | Line 35: | ||
=== Documentation === | === Documentation === | ||
* [https://help.dyalog.com/latest/index.htm#Language/Introduction/Variables/Prototypes | * [https://help.dyalog.com/latest/index.htm#Language/Introduction/Variables/Prototypes%20and%20Fill%20Items.htm Dyalog] | ||
{{APL features}}[[Category:Function characteristics]] | {{APL features}}[[Category:Function characteristics]] |
Latest revision as of 14:19, 16 May 2023
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 | 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 |