I wrote:
> But a more convincing reason arises when we ask "if not 0,
> then what should L.0$a: produce?". How deep is such an array?
> If that empty array is boxed, then we can say the depth is 1+ the
> depth of the boxed contents. But what are the contents of the boxes
> that don't exist? Do they, too, contain boxes that don't exist?
Following onto this reasoning, I meant to ask the following question, but
forgot:
If we had the luxury of breaking backwards compatibility, would _
be a more desirable result for L.0$a: ?
I don't think it would be. For one thing, it would make testing for "real"
boxed arrays more cumbersome; today we say 0<L. but that wouldn't work if
empty arrays with type boxed were considered infinity deep (we'd have to say
(0&< *. _&>)@:L. or something).
But, more importantly, I think it is important that J maintain consistency,
so that as much as possible asking the same question in different ways
results in the same answer. If we are to consider all empty vectors
equivalent (and I agree we should), then it is inconsistent to maintain that
'' -: 0$a: yet '' ~:&L. 0$a: .
Also, I just realized today that, at least for sorting & grading, empty is
considered its own "type" (on par with numeric, literal, symbolic, boxed,
etc). In the Vocab entry for /: [1] we read:
The types: numeric or empty, symbol, literal (1 byte or 2 byte
characters), and boxed, are so ordered
The longer I spend studying J's design, and learning how it has anticipated
and answered difficult questions, the more admiration I have for its
designers.
-Dan
[1] http://www.jsoftware.com/help/dictionary/d422.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm