http://www.jsoftware.com/jwiki/Essays/Odometer
----- Original Message ----- From: Steven Taylor <[email protected]> Date: Monday, September 5, 2011 6:55 Subject: [Jprogramming] all indicies of a shape To: Programming forum <[email protected]> > 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
