Well, what holds for APL, holds for J:

APL: You shoot yourself in the foot, then spend all day figuring out how to
do in fewer characters. 
see http://tinyurl.com/2ogsky

Mostly I also work from right-to-left and spend some time cleaning up the
code. 
So I should have started with ;@: at the right hand side and finally move it
to left ;-)

The first two remarks are more important than the last one. 
Not writing [:;] is rather elementary. 
Than [:>[:#&.>] becomes by [:>#&.> of which one sees immediately that it
should be #&>


R.E. Boss


> -----Oorspronkelijk bericht-----
> Van: [EMAIL PROTECTED] [mailto:programming-
> [EMAIL PROTECTED] Namens Matthew Brand
> Verzonden: donderdag 28 februari 2008 11:02
> Aan: Programming forum
> Onderwerp: RE: [Jprogramming] boxed data manipulation
> 
> Thanks,
> 
> I never cease to be amazed by J.
> 
> When you write a tacit verb like (;@; $~ 2,~[:+/ #&>)
> from scratch do you do it left-to-right (starting with
> ;@;) or right-to-left (starting with #&>)? I always
> start at the right and add new things to the left.
> Maybe that is where I am going wrong and ending up
> with so many brackets and caps.
> 
> --- "R.E. Boss" <[EMAIL PROTECTED]> wrote:
> 
> > [: ;[:; ] should be ;@;
> > +/[: > [: #&.> ] should be #&>
> >
> > which leaves us with
> >
> >    ((([:+/ #&>),2:)$;@;) (<10 20);<(3 4;<1 2)
> > 10 20
> >  3  4
> >  1  2
> >
> > which could be further simplified to
> >
> >    (;@; $~ 2,~[:+/ #&>) (<10 20);<(3 4;<1 2)
> > 10 20
> >  3  4
> >  1  2
> >
> >
> > R.E. Boss
> >
> >
> >
> > > -----Oorspronkelijk bericht-----
> > > Van: [EMAIL PROTECTED]
> > [mailto:programming-
> > > [EMAIL PROTECTED] Namens Matthew Brand
> > > Verzonden: donderdag 28 februari 2008 10:19
> > > Aan: Programming forum
> > > Onderwerp: Re: [Jprogramming] boxed data
> > manipulation
> > >
> > > Thanks Peter, that got me there.
> > >
> > > I added this bit of code to make it count the
> > number
> > > of rows that would be output for the reshape verb
> > > (since I don't know that from the outset).
> > >
> > > I always end up using [: a lot when I write tacit
> > > programs. Out of interest, does anyone know a
> > cleaner
> > > way to write the tacit expression below?
> > >
> > >  ( (([: +/[: > [: #&.> ]),2:) $ [: ;[:; ]) (<10
> > > 20);<(3 4;<1 2)
> > >
> > > Cheers,
> > > Matthew.
> > >
> > > --- Peter Vingron <[EMAIL PROTECTED]> wrote:
> > >
> > > > Hallo Mathew,
> > > >
> > > > Is this of any help?:
> > > >
> > > >    3 2$;;(<10 20);<(3 4;< 1 2)
> > > >
> > > > regards,
> > > > Peter
> > > >
> > > >
> > > > Matthew Brand schrieb:
> > > > > Hi All,
> > > > >
> > > > > How can I get pairs of numbers which are in
> > boxes
> > > > like
> > > > > this:
> > > > > (<10 20);<(3 4;< 1 2)
> > > > >
> > > > > out into an array that looks like this:
> > > > > 3 2 $ 10 20 3 4 1 2
> > > > >
> > > > > The contents of each box are x,y data points
> > that
> > > > I
> > > > > want to lump together and model.
> > > > >
> > > > > The number of levels/structure is always as in
> > the
> > > > > example, that is a list of boxes where each
> > box
> > > > > contains a list of boxes where the boxes
> > contain a
> > > > > list of 2 numeric atoms.
> > > > >
> > > > > Thanks,
> > > > > Matthew.
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> __________________________________________________________
> > > > > Sent from Yahoo! Mail.
> > > > > A Smarter Inbox.
> > > > http://uk.docs.yahoo.com/nowyoucan.html
> > > > >
> > > >
> > >
> >
> ----------------------------------------------------------------------
> > > > > For information about J forums see
> > > > http://www.jsoftware.com/forums.htm
> > > > >
> > > > >
> > > >
> > > >
> > >
> >
> ----------------------------------------------------------------------
> > > > For information about J forums see
> > > > http://www.jsoftware.com/forums.htm
> > > >
> > >
> > >
> > >
> > >
> >
> ___________________________________________________________
> > > Rise to the challenge for Sport Relief with Yahoo!
> > For Good
> > >
> > > http://uk.promotions.yahoo.com/forgood/
> > >
> >
> ----------------------------------------------------------------------
> > > For information about J forums see
> > http://www.jsoftware.com/forums.htm
> >
> >
> ----------------------------------------------------------------------
> > For information about J forums see
> > http://www.jsoftware.com/forums.htm
> >
> 
> 
> 
>       __________________________________________________________
> Sent from Yahoo! Mail.
> A Smarter Inbox. http://uk.docs.yahoo.com/nowyoucan.html
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to