On Wed, Jul 29, 2009 at 12:45 PM, bill lam<[email protected]> wrote: > On Wed, 29 Jul 2009, Raul Miller wrote: >> On Wed, Jul 29, 2009 at 9:26 AM, Kip Murray<[email protected]> wrote: >> > I think we have agreed that (32 = 3!:0) tests >> > whether y is boxed. >> >> I have agreed to no such thing. >> >> (32 = 3!:0) y >> >> tests whether elements of y are boxed. > > Can you elaborate your statement? 32=3!:0 y is the test for box until > the verb L. is introduced. At least L. was absent in J7 (not the next > J7 of course).
3!:0 tells me the implementation constant which I use to determine the structure of the contents of the array -- their size and the meaning of their bits. In general, it does not tell me their type, since multiple different internal constants may be used to represent different encodings of the same type. Also... I do not have a copy of J7 handy, but I seem to remember that overtake on an empty "boxed" array in J7 would not produce a boxed result. Also, if Y is an empty "boxed" array, then Y,'Z' would be valid, but if X is a non-empty boxed array, then X,'Z' would not be valid. Also, if J allowed heterogeneous arrays, we could not meaningfully talk of the type of an array -- we could only talk of the type of its elements. In other words, "type of the array" is really shorthand for "type of the elements of the array". We can get away with this shorthand, in J, because all elements in a J array must be the same type, but this reasoning does not hold for empty arrays. If J was strict about its treatment of empty arrays, it would be meaningful to talk about their types. For example, if '',0 were erroneous. However, this is not the case. (I believe Roger recently changed overtake so that it would "preserve the type of the empty array" but he was very clear that he thought this was ad hoc behavior and that this was not consistent with the design of the rest of the language.) FYI, -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
