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

Reply via email to