4,505
edits
(Make clearer what's going on) |
|||
Line 16: | Line 16: | ||
=== Rank extension === | === Rank extension === | ||
The term "scalar extension" is sometimes used to refer to the practice of allowing a scalar when a higher rank is expected. The scalar is treated as an array of the expected minimum rank whose shape is a vector of 1s (that is, a [[singleton]]). For example, <source lang=apl inline>⍳8</source> and <source lang=apl inline>8⍴'a'</source> both produce an 8 | The term "scalar extension" is sometimes used to refer to the practice of allowing a scalar when a higher rank is expected. The scalar is treated as an array of the expected minimum rank whose shape is a vector of 1s (that is, a [[singleton]]). For example, <source lang=apl inline>⍳8</source> and <source lang=apl inline>8⍴'a'</source> both produce an array of shape <source lang=apl inline>,8</source> (a vector) even though they were given a shape specification of <source lang=apl inline>8</source> (a scalar). This type of extension, which differs from ordinary scalar extension in that there is no expected shape and only an expected rank, has also been present since [[APL\360]]. | ||
=== Singleton extension === | === Singleton extension === |