[Jprogramming] ^: and boxes
R.E. Boss
r.e.boss at outlook.com
Mon May 12 20:56:53 UTC 2014
>((0,~ 2=S:0 }.) (4 :'x}y') ],:2*L:0]) ;/1 2 3 2 2 4 2 1
2 2 6 4 2 8 2 1
R.E. Boss
(Add your info to http://www.jsoftware.com/jwiki/Community/Demographics )
> -----Original Message-----
> From: programming-bounces at forums.jsoftware.com [mailto:programming-
> bounces at forums.jsoftware.com] On Behalf Of R.E. Boss
> Sent: maandag 12 mei 2014 22:45
> To: programming at jsoftware.com
> Subject: Re: [Jprogramming] ^: and boxes
>
> Ignore the boxing.
>
> (* 0>:@,~2=}.) 1 2 3 2 2 4 2 1
> 2 2 6 4 2 8 2 1
>
>
> R.E. Boss
>
> (Add your info to
> http://www.jsoftware.com/jwiki/Community/Demographics )
>
>
>
> > -----Original Message-----
> > From: programming-bounces at forums.jsoftware.com
> [mailto:programming-
> > bounces at forums.jsoftware.com] On Behalf Of 'Pascal Jasmin' via
> > Programming
> > Sent: maandag 12 mei 2014 19:12
> > To: Programming forum
> > Subject: [Jprogramming] ^: and boxes
> >
> > I'm looking for this answer, but a better way to do it.
> >
> > > ({~"1 0 [: i.#) (<@:+:@>)^:(1 |. 2= ] &>) ;/ 1 2 3 2 2 4 2 1
> > 2 2 6 4 2 8 2 1
> >
> > the right hand side must be boxed. Unboxing at end, just there for
> > display. Should not assume that it is possible for input.
> >
> > What the above is doing is if/for a cell that is equal to 2, double the
> previous
> > cell.
> >
> > To get it to work, I've had to generate a full n x n table, and then
take
> the
> > diagonal. Is there a better tacit way that avoids n x n table?
> > ----------------------------------------------------------------------
> > For information about J forums see
> http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list