> Van: [email protected] [mailto:programming-
> [email protected]] Namens Dan Bron
> Verzonden: dinsdag 31 augustus 2010 1:42
(...)
> 
> If you're wondering why _1 _1 doesn't give the bottom-right corner of the
> array, like f[0][0] (or maybe f[0;0]) would give the top-left corner of a
> 2D
> array in a C-like language, the answer is: in J, compound
> (multi-dimensional) indices are addressed with boxes.
> 
> There are many ways to present the rationale for this decision, but an
> easy
> one is: conceptually, a compound index is a single, atomic thing, yet has
> structure (this seems contradictory until you work through some examples,
> e.g. "the bottom-right corner" of a 2D array).  In J, atoms with
> (arbitrary)
> structure are represented with boxes.  Voila.
> 
(...)


I disagree with your reasoning.

The only reason for the behavior of { is its rank. So the answer to "why _1
_1 { (NB. the { !(reb)) doesn't give the bottom-right corner of the array"
is: the left hand rank of the dyad { is 0  .
Compare this to dyad {.  which has a lh-rank of 1 :

   _1 _1 {. i.4 5
19

So IMO it has nothing to do with "in J, compound (multi-dimensional) indices
are addressed with boxes".
As this appears to be not a decision, it does need a rationale either.


R.E. Boss

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to