Fill element: Difference between revisions

Jump to navigation Jump to search
431 bytes added ,  14:19, 16 May 2023
m
→‎Documentation: Encode spaces in URL
Miraheze>Marshall
(Created page with "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 usual...")
 
m (→‎Documentation: Encode spaces in URL)
 
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
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 <source lang=j inline>!.</source>, an analogue of [[Variant]].
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 <syntaxhighlight lang=j inline>!.</syntaxhighlight>, 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.
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.
The following functions and operators may use fill elements in their results.
Line 8: Line 10:
! Glyph                              !! Monad                                          !! Dyad
! Glyph                              !! Monad                                          !! Dyad
|-
|-
| <source lang=apl inline>⍴</source> ||                                                || [[Reshape]]
| <syntaxhighlight lang=apl inline>⍴</syntaxhighlight> ||                                                || [[Reshape]]
|-
|-
| <source lang=apl inline>↑</source> || [[Mix]] (or <source lang=apl inline>⊃</source>) || [[Take]]
| <syntaxhighlight lang=apl inline>↑</syntaxhighlight> || [[Mix]] (or <syntaxhighlight lang=apl inline>⊃</syntaxhighlight>) || [[Take]]
|-
|-
| <source lang=apl inline>/</source> and <source lang=apl inline>⌿</source> ||          || [[Replicate]]
| <syntaxhighlight lang=apl inline>/</syntaxhighlight> and <syntaxhighlight lang=apl inline>⌿</syntaxhighlight> ||          || [[Replicate]]
|-
|-
| <source lang=apl inline>\</source> and <source lang=apl inline>⍀</source> ||          || [[Expand]]
| <syntaxhighlight lang=apl inline>\</syntaxhighlight> and <syntaxhighlight lang=apl inline>⍀</syntaxhighlight> ||          || [[Expand]]
|-
|-
| <source lang=apl inline>⍤</source> ||colspan=2| [[Rank operator]]
| <syntaxhighlight lang=apl inline>⍤</syntaxhighlight> ||colspan=2| [[Rank operator]]
|-
|-
| <source lang=apl inline>⌸</source> ||colspan=2| [[Key]]
| <syntaxhighlight lang=apl inline>⌸</syntaxhighlight> ||colspan=2| [[Key]]
|-
|-
| <source lang=apl inline>⌺</source> ||colspan=2| [[Stencil]]
| <syntaxhighlight lang=apl inline>⌺</syntaxhighlight> ||colspan=2| [[Stencil]]
|}
|}


Line 28: Line 30:


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.
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 ===
* [https://help.dyalog.com/latest/index.htm#Language/Introduction/Variables/Prototypes%20and%20Fill%20Items.htm Dyalog]
{{APL features}}[[Category:Function characteristics]]

Navigation menu