f=: 4 : 'c-~y*0=c=. 2-~/\0,x<.+/\y'

   a=: 2*5+i.5
   35.5 f a
_10 _12 _13.5 16 18
   36 f a
_10 _12 _14 16 18

It is possible that the application would be
better served with the separate results
10 12 13.5 0 0 (used) and 0 0 0.5 16 18 (remainder)
for 35.5 f a .



----- Original Message -----
From: Roger Hui <[email protected]>
Date: Wednesday, January 27, 2010 8:59
Subject: Re: [Jprogramming] Running Subtraction
To: Programming forum <[email protected]>

> a*_1^0>:b-+/\a gets close, with a fix-up required
> for the element on the boundary.
> 
> The result is the negation of the usage in each bin,
> but unused bins retain their original values.
> 
> 
> 
> ----- Original Message -----
> From: Raul Miller <[email protected]>
> Date: Wednesday, January 27, 2010 8:45
> Subject: Re: [Jprogramming] Running Subtraction
> To: Programming forum <[email protected]>
> 
> > On Wed, Jan 27, 2010 at 10:54 AM, Alex Rufon 
> <alex_ru...@ist-
> > systems.com> wrote:
> > >   [a=. 2 * 5 + i. 5
> > > 10 12 14 16 18
> > >   [b=. 35.5
> > > 35.5
> > ...
> > > I want to subtract a from b progressively until b is 0 so 
> from 
> > the data above I'll get the following results:
> > > _10 _12 _13.5 16 18
> > 
> > This description does not make sense to me.
> > 
> > Here are my guesses for where these numbers came from:
> > 
> > _10  -:  -0{a
> > _12  -:  -1{a
> > _13.5  -: b - +/0 1{a
> > 16  -:  3{a
> > 18  -:  4{a
> > 
> > But I can not figure out how my guesses relate to
> > your description.
> > 
> > If I understood your description properly, you might
> > be interested in something like:
> >       b-+/\.&.|. a
> > 25.5 13.5 _0.5 _16.5 _34.5
> > or
> >    0 >. b-+/\.&.|. a
> > 25.5 13.5 0 0 0
> > 
> > But I am not at all confident that this is what you
> > are looking for.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to