2,951
edits
Miraheze>Marshall mNo edit summary |
m (Categories) |
||
(6 intermediate revisions by 4 users not shown) | |||
Line 12: | Line 12: | ||
The word "extension" applies to scalar extension in two ways: first, a function is extended by making a case which would have been a [[RANK ERROR]] into a valid application. Second, the application works by conceptually extending the scalar to function as though it were an array of higher rank. | The word "extension" applies to scalar extension in two ways: first, a function is extended by making a case which would have been a [[RANK ERROR]] into a valid application. Second, the application works by conceptually extending the scalar to function as though it were an array of higher rank. | ||
Two arrays are said to [[Conformability|conform]] if they have the same shape or at least one can be extended (it is a scalar, or, in langauges with singleton extension, has exactly one element). A pair of conforming arrays defines a single shape which describes how their elements are paired: if neither is a scalar, it is their shared shape; if one is a scalar, it is the other's shape; if both are scalars, it is <source lang=apl inline>⍬</source>. | Two arrays are said to [[Conformability|conform]] if they have the same shape or at least one can be extended (it is a scalar, or, in langauges with singleton extension, has exactly one element). A pair of conforming arrays defines a single shape which describes how their elements are paired: if neither is a scalar, it is their shared shape; if one is a scalar, it is the other's shape; if both are scalars, it is the [[empty]] vector, <source lang=apl inline>⍬</source> ([[Zilde]]). | ||
=== Rank extension === | === Rank extension === | ||
Line 38: | Line 38: | ||
== Examples == | == Examples == | ||
Dyadic [[scalar functions]] and the [[Each | Dyadic [[scalar functions]] and the [[Each]] operator use scalar extension to pair their arguments: | ||
<source lang=apl> | <source lang=apl> | ||
1 2 3 4 * 2 | 1 2 3 4 * 2 | ||
Line 64: | Line 64: | ||
larsca | larsca | ||
</source> | </source> | ||
{{APL features}}[[Category:Function characteristics]][[Category:Conformability]] |