The only way I. I.^:_1 changes x is that it sorts it, and I.^:_1 I. only cuts out the trailing 0s: Ii=. ([: <:@(#/.~) i.@>:@(>./) , ]) (; (;Ii)@I.) 1...@$2 ┌───────────────────┬───────────┬─────────────────┐ │1 1 1 0 0 1 1 0 1 0│0 1 2 5 6 8│1 1 1 0 0 1 1 0 1│ └───────────────────┴───────────┴─────────────────┘ (; (;I.)@Ii) 6...@$10 ┌───────────┬─────────────────┬───────────┐ │0 0 8 6 6 3│2 0 0 1 0 0 2 0 1│0 0 3 6 6 8│ └───────────┴─────────────────┴───────────┘
I think each of these cases is acceptable, especially if you allow !. to change the universe (this removes the I.^:_1 I. problem). Marshall -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Roger Hui Sent: Monday, September 06, 2010 2:26 AM To: Programming forum Subject: Re: [Jprogramming] Mask from list of indices with multiplicity I.^:_1 seems too far from what <:#/.~universe,x does. Another way to say that is that I. I.^:_1 x can bear scant resemblance to x . ----- Original Message ----- From: Zsbán Ambrus <[email protected]> Date: Sunday, September 5, 2010 14:21 Subject: Re: [Jprogramming] Mask from list of indices with multiplicity To: Programming forum <[email protected]> > On Sun, Sep 5, 2010 at 10:57 PM, Roger Hui <[email protected]> wrote: > > <: #/.~ (i.7) ,x > > Nice solution. > > > ----- Original Message ----- > > From: Zsbán Ambrus <[email protected]> > >> Would it make > >> sense if I.^:_1 did this? > > ^^^ What's your opinion on this? ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
