I am impressed by the J programming language and by the array concept. However, boxed arrays and sparse arrays and empty arrays illustrate shortcomings in the array concept of J. I suggest using ordinal fractions for structuring, storing and handling data. Then there is no need for boxing, nor for differentiating between sparse arrays and other arrays. However I have not constructed a programming language like J to manipulate such data. The concept is introduced in the old article behind this link. (Sadly the e-mail software tend to disrupt my links. I hope this link survives). https://www.academia.edu/10031088/ORDINAL_FRACTIONS_-_the_algebra_of_data
Here are some differences between arrays and Ordinal Fractions (OFs): - Arrays have different shapes. OFs have the same shape: (_$9) - J-arrays have zero-origin indexing. OFs have one-origin indexing. - Arrays may have elements. OFs have no elements. - Array elements contain data. OFs may contain data. - Arrays may contain subarrays. OFs always contain subordinate OFs. - An array may have a name. An OF may contain a name. - In J a scalar differs from a shape 1 array. Not so in OFs. Here are some differences between nonnegative integers and (OFs): - Any sequence of digits (0 1 . . . 9) represents a base-ten integer, or a base-nine OF. - Integers may be padded with zeroes to the left, OFs to the right. - Digit 0 in an integer indicate that a term is omitted. Digit 0 in an OF indicate that a condition is omitted. - The integer 0 means "nothing". The OF 0 means "everything". I think that ordinal fractions is a unified way of structuring data: scalars, arrays, trees, databases.alike. Thanks Bo. Den 13:32 onsdag den 20. december 2017 skrev Raul Miller <rauldmil...@gmail.com>: Actually, J does support arrays of nothing. That's what i.0 is, after all. And, if you want a scalar containing an array of nothing, then a: matches that specification. And we have an algebra here - though if (as in your previous message) you do multiplication and call it addition, this becomes very difficult to talk about. That said, remember that we can add an arbitrary number of leading 1 dimensions to any array without changing the number of elements in that array. Thanks, -- Raul On Wed, Dec 20, 2017 at 4:03 AM, Erling Hellenäs <erl...@erlinghellenas.se> wrote: > Hi all ! > > Could we avoid doing these peculiar things in the rank operator if we > enabled the handling of arrays of nothing? > > The verb injected in Rank would then have to give a valid result for an > array of nothing? > > For this to happen J functions have to be defined for handling arrays of > nothing? > > Would it be possible to define an algebra for the handling of arrays of > nothing? > > Could this be the same as enabling missing data? > > Cheers, > > Erling > > > > Den 2017-12-20 kl. 09:46, skrev Erling Hellenäs: >> >> This is a mathematical concept: >> https://en.wikipedia.org/wiki/Empty_product /Erling >> >> >> Den 2017-12-20 kl. 09:39, skrev Erling Hellenäs: >>> >>> */i.0 >>> >>> 1 >>> >>> Here the interpreter automatically adds a 1 to get this peculiar result. >>> >>> /Erling >>> >>> Den 2017-12-19 kl. 20:01, skrev Raul Miller: >>>> >>>> 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, >>>> >>> >>> ---------------------------------------------------------------------- >>> 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 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm