not empty rank rather o rank On Tue, Dec 19, 2017 at 2:01 PM, Raul Miller <[email protected]> wrote:
> An empty tank zero array would be inconsistent. > > The number of elements in an array is the product of its dimensions, and > the multiplicative identity is 1, not 0. > > Thanks, > > -- > Raul > > On Tuesday, December 19, 2017, Jimmy Gauvin <[email protected]> > wrote: > > > Hi, > > > > Thinking about nothing, specifically about the empty scalar or empty > > 0-cell. > > > > Erling H. - " I experience an inconsistency in this model in the sense > > that an array of rank greater than zero can be empty, a 0-cell can not." > > > > The internal structure of a J array could support a rank 0 empty object. > > However, short of poking into memory, there does not seem to be a way of > > generating an empty scalar. > > > > ┌───────┬─┬───────┬─┬─┬─────┬───┐ > > │data │ │type │n│r│shape│val│ > > ├───────┼─┼───────┼─┼─┼─────┼───┤ > > │8 │ │integer│1│0│ │8 │ > > ├───────┼─┼───────┼─┼─┼─────┼───┤ > > │8 9 │ │integer│2│1│2 │8 9│ > > ├───────┼─┼───────┼─┼─┼─────┼───┤ > > │'' │ │literal│0│1│0 │ │ > > ├───────┼─┼───────┼─┼─┼─────┼───┤ > > │0$0 │ │boolean│0│1│0 │ │ > > ├───────┼─┼───────┼─┼─┼─────┼───┤ > > │0$8 │ │integer│0│1│0 │ │ > > ├───────┼─┼───────┼─┼─┼─────┼───┤ > > │0 0 0$8│ │integer│0│3│0 0 0│ │ > > ├───────┼─┼───────┼─┼─┼─────┼───┤ > > │(0$0)$8│ │integer│1│0│ │8 │ > > └───────┴─┴───────┴─┴─┴─────┴───┘ > > n = number of values > > r = rank > > > > NB. Trying to get n=0 and r=0 > > > > (0$0) $ (0$0) > > |length error > > | (0$0) $(0$0) > > (0$0) $ '' > > |length error > > | (0$0) $'' > > > > > > > > > > > > On Tue, Dec 19, 2017 at 4:28 AM, Erling Hellenäs < > [email protected] > > > > > wrote: > > > > > Hi all ! > > > > > > In APL we had the same array model as in Fortran. An array was an array > > > and you indexed it like in most other languages, except that you could > > use > > > an array as index and therefore could get very varying results. The > only > > > problems I personally experienced with this model was that you could > not > > > put all the indexes in one variable. I also wanted to have the index to > > the > > > left. To keep the right-to-left normal flow of the language. I wrote > > > special indexing functions to handle this, but never used them in > > > production. > > > > > > In J we have the n-cell array model. A difference is that a scalar is > > just > > > another array, it just is imagined as having zero dimensions. I APL > there > > > were scalars and there were arrays, basically two different data > > > structures. I experience an inconsistency in this model in the sense > that > > > an array of rank greater than zero can be empty, a 0-cell can not. At > > least > > > in the interpreter I wrote, there is a lot of special handling of > 0-cells > > > because they actually have content, although there are no array > > dimensions > > > which could reasonably contain any such content. > > > > > > In the dyadic rank operator a k-cell without any zero dimension can be > > > empty because a containing array is. This causes the very particular > > > special handling I mentioned in the thread "[Jprogramming] i. (2 2 $ 1 > 2 > > 3 > > > 4)" > > > > > > Simplicity is important for performance, it is important for our > ability > > > to predict the behaviour of the code without testing it in the terminal > > and > > > to limit the number of test cases needed to verify the functonality of > a > > > program. > > > > > > Is there any documentation of the design decision to select the n-cell > > > array model? > > > > > > Are there any threads in the forum where this array model is discussed? > > > > > > Maybe someone also wants to share their knowledge from internal > > > discussions about this design decision. > > > > > > Cheers, > > > > > > Erling Hellenäs > > > > > > ---------------------------------------------------------------------- > > > For information about J forums see http://www.jsoftware.com/forums.htm > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
