Splitting up the phrase in three parts:

+/\y
is the running sum
   +/\10 12 14 16 18
10 22 36 52 70

x<.y gives minimum values,
   35.5 <.+/\10 12 14 16 18
10 22 35.5 35.5 35.5

2-~/\0,y
is the forward difference
   2-~/\0,35.5 <.+/\10 12 14 16 18
10 12 13.5 0 0

The 0 is necessary to retain the first element.
   2-~/\35.5 <.+/\10 12 14 16 18
12 13.5 0 0







Hallo Alex Rufon, je schreef op 28-01-10 03:50:
> I have a question.
>
> In Rogers code:
> 2-~/\0,x<.+/\y
>
> I understood that 'x<.+/\y' gives the floor for each value. What I don't get 
> is '2-~/\0,'?
>
> I would appreciate further clarification. Thanks.
>
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Roger Hui
> Sent: Thursday, January 28, 2010 2:41 AM
> To: Programming forum
> Subject: Re: [Jprogramming] Running Subtraction
>
>    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
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
>
>   

-- 
Met vriendelijke groet,
=@@i

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

Reply via email to