Conceptually, the data type of a list is the type of its elements. When the list has no elements, the type is arbitrary but structural operations tend to preserve that arbitrary type.
(Note also that there's other concepts of "type" floating around in the J implementation, which I am trying to avoid stepping on here with my use of the phrase 'data type'. For example, there's syntactic type -- noun, verb, etc. Also, some languages would treat array shape as type information, though that's becoming less of a thing nowadays.) I hope this makes sense, -- Raul On Thu, Dec 29, 2022 at 2:09 AM Igor Zhuravlov <[email protected]> wrote: > > On Wed, 12/28/2022 01:58 PM Henry Rich wrote: > > It is a canon of J that an empty list has no contents. > > Aha, it's time to me to memorize it. Thank you. Now I see the reason of > datatype leakage out which I've marked as "problem #2". > > Although it looks a little confusing: > > ]&.:(3&}.) 2 $ < 1 2 3 4 NB. (]) preserves a datatype > ++++ > |||| > ++++ > ] L: 0&.:(3&}.) 2 $ < 1 2 3 4 NB. (L:) preserves a datatype here (why?) > ++++ > |||| > ++++ > 1&+ L: 0&.:(3&}.) 2 $ < 1 2 3 4 NB. (L:) resets a datatype to default > i.e. open (canon in action) > 0 0 0 > > -- > Regards, > Igor > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
