Correction, see below.

R.E. Boss


> -----Oorspronkelijk bericht-----
> Van: [EMAIL PROTECTED] [mailto:programming-
> [EMAIL PROTECTED] Namens R.E. Boss
> Verzonden: zondag 26 augustus 2007 10:30
> Aan: 'Programming forum'
> Onderwerp: RE: [Jprogramming] sequential partition
> 
> Well, my solution was wrong since I misunderstood your specs.
> 
> But the basic idea was even better than I thought, so I could come up with
> the required answer in one go. Here it is:
> 
>       (}: , |.&.>@{:)@(( ( ([: <`({. ; |[EMAIL PROTECTED])@.(30 < +/) ,) 
> >@{.) ,
> [EMAIL PROTECTED])/&.|.) 9 6 3 4 5 5 3 7 9 8 7 3 9 9 6 3 5 7 8 9
>               NB. line wrap
> +---------+-------+-------+---------+---+
> |9 6 3 4 5|5 3 7 9|8 7 3 9|9 6 3 5 7|8 9|
> +---------+-------+-------+---------+---+
> 
> Eplanation:
> - I want to use scan so I need &.|. first, (SomeVerb)/&.|. it will be.
> 
> - Suppose you're in the middle of the process and you're here:
> 
>                       v
> +---------+-------+-------+---------+---+
> |9 6 3 4 5|5 3 7 9|8 7 3 9|9 6 3 5 7|8 9|
> +---------+-------+-------+---------+---+
> 
> The left argument of SomeVerb is 3 and the right argument is:
>  (NB. reversed order!)
> 
> +---+-------+---------+
> |7 8|9 7 3 5|5 4 3 6 9|
> +---+-------+---------+

This should have been:

+---+-------+---------+
|7 8|5 3 7 9|9 6 3 4 5|
+---+-------+---------+

> and 3 has to be prepended to 7 8. So
> 
>    SomeVerb = (Prpnd >@{.) , [EMAIL PROTECTED]
> 
> (Prpnd >@{.) being a hook.
> 
> Prpnd is ,(append). If the sum of the result is <:30 , it should be boxed,
> but if >30 , the left argument should not be prepended, but be a box on
> its
> own. This results in
> 
>    Prpnd=: [: <`({. ; |[EMAIL PROTECTED])@.(30 < +/) ,
> 
> so if 30<+/ than {. (which was the left argument of Prprnd) is linked with
> |[EMAIL PROTECTED] (its right argument) the |. being necessary from the 
> initial &.|.
> 
> - The final (}: , |.&.>@{:)is needed because the last box was left
> unreversed.
> 
> End of Explanation.
> 
> Is this sufficient clear?
> 
> 
> R.E. Boss
> 
> 
> > -----Oorspronkelijk bericht-----
> > Van: [EMAIL PROTECTED] [mailto:programming-
> > [EMAIL PROTECTED] Namens bill lam
> > Verzonden: zaterdag 25 augustus 2007 3:31
> > Aan: Programming forum
> > Onderwerp: Re: [Jprogramming] sequential partition
> >
> > R.E. Boss wrote:
> > >>From the hip:
> > >
> > >      ([:((]`(0:,])@.(30<:]))@(+{.),[,[EMAIL PROTECTED])/,&0)&.|.  9 6 3 4 
> > > 5 5 3 7 9
> 8
> > 7 3
> > > 9 9 6 3 5 7 8 9                   NB. line wrap
> > > 9 6 3 4 5 5 32 3 7 9 8 7 34 3 9 9 6 3 30 5 7 8 9 29
> > >
> > > the subsums >: 30 and the final  subsum are inserted.
> >
> > Boss,
> >
> > I'm sorry that I cannot understand your solution, could you explain how
> it
> > work?
> >
> > --
> > regards,
> > bill
> > ----------------------------------------------------------------------
> > 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

Reply via email to