I'm not sure I grok you fully, but here's my 2¢ ...
An array containing its own coordinates comes in useful for debugging
structural operations on arrays.
I find this convenient at times (it can be generalised, if S contains
elements >9)...
S=: 2 4 2
S {. i.3#10
On Mon, Sep 5, 2011 at 2:53 PM, Steven Taylor <[email protected]> wrote:
> I got curious about producing all elements of an array of the shape S.
>
> This is what I came up with:
>
> [S=.2 4 2
> [prd=.1,}:*/\ S
> [c=.(*/S)
> S|"(0 1) prd ([:<.%~)"(0 1) i. c
>
> Which is kind of similar to:
>
> { (i.2);(i.4);(i.2)
>
> ... hmm... but how do you raise those results into 3x1 lists?
>
> Background:C# has some limitations when it comes to using pointers against n
> dimensional arrays of type T (one dimensional are mostly okay). There's a
> concept of "blitable". I'll save you any more tedium. Was just using J to
> think around the issue... which revealed some nice J features + possibly a
> deeper insight. Just thought I'd share that.
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm