Scalar: Difference between revisions

Jump to navigation Jump to search
4 bytes added ,  08:18, 16 October 2019
no edit summary
Miraheze>Marshall
(Created page with "A scalar is an array with rank zero, that is, empty shape. A scalar contains only a single element: its bound is the product of the empty list <code>×/⍬</code>,...")
 
Miraheze>Marshall
No edit summary
Line 7: Line 7:
The [[floating array model]] identifies the enclose of a [[simple scalar]] (that is, a scalar array containing a simple scalar) with the scalar itself. However, the enclose of a non-simple scalar, such as an enclosed matrix, is still distinct from its element.
The [[floating array model]] identifies the enclose of a [[simple scalar]] (that is, a scalar array containing a simple scalar) with the scalar itself. However, the enclose of a non-simple scalar, such as an enclosed matrix, is still distinct from its element.


Under a strict definition a scalar has no [[major cell|major cells]], since a major cell of a rank 0 array would have rank ¯1, which is impossible. A common convention in array langauges such as [[Dyalog]] and [[J]] which define functions in terms of major cells is that a scalar has a single major cell—itself. Thus <code>≢'a'</code> is equal to 1. Similarly, it is common for functions or operators which act on the axes of an array to act as though the array has an invisible axis of length 1. [[Reverse|Reversing]] or [[Reduce|reducing]] a scalar yields that scalar with no changes.
Under a strict definition a scalar has no [[major cell|major cells]], since a major cell of a rank 0 array would have rank ¯1, which is impossible. A common convention in array langauges such as [[Dyalog APL]] and [[J]] which define functions in terms of major cells is that a scalar has a single major cell—itself. Thus <code>≢'a'</code> is equal to 1. Similarly, it is common for functions or operators which act on the axes of an array to act as though the array has an invisible axis of length 1. [[Reverse|Reversing]] or [[Reduce|reducing]] a scalar yields that scalar with no changes.


Iverson's [[A Dictionary of APL]] uses the name "item" for scalars.
Iverson's [[A Dictionary of APL]] uses the name "item" for scalars.
Anonymous user

Navigation menu