(#: i.@(*/))2 4 2 0 0 0 0 0 1 0 1 0 0 1 1 0 2 0 0 2 1 0 3 0 0 3 1 1 0 0 1 0 1 1 1 0 1 1 1 1 2 0 1 2 1 1 3 0 1 3 1
R.E. Boss > -----Oorspronkelijk bericht----- > Van: [email protected] [mailto:programming- > [email protected]] Namens Don Guinn > Verzonden: maandag 5 september 2011 16:12 > Aan: Programming forum > Onderwerp: Re: [Jprogramming] all indicies of a shape > > > >,{ (i.2);(i.4);(i.2) > 0 0 0 > 0 0 1 > 0 1 0 > 0 1 1 > 0 2 0 > 0 2 1 > 0 3 0 > 0 3 1 > 1 0 0 > 1 0 1 > 1 1 0 > 1 1 1 > 1 2 0 > 1 2 1 > 1 3 0 > 1 3 1 > > But how about ([#:[:i.*/)S > > > On Mon, Sep 5, 2011 at 7:53 AM, 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 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
