I think you taught me this approach in chapter 16 of  JforC Programmers,  Henry 
:)

modPlus=: |+[*0=|  
   12 modPlus  9 + i. 7
9 10 11 12 1 2 3

Cheers, bob

On 2012-12-24, at 12:54 PM, Henry Rich wrote:

> I don't get what your 'offset' field is, but |&.<: might be useful:
> 
>   12 | 9+i. 7
> 9 10 11 0 1 2 3
>   12&|&.<: 9+i. 7
> 9 10 11 12 1 2 3
> 
> Henry Rich
> 
> On 12/24/2012 3:49 PM, PackRat wrote:
>> I have need for a verb like residue | but which returns the mod value
>> instead of 0.  For example, instead of 9 10 11 0 1 2 3 4... for a mod
>> value of 12, it will return 9 10 11 12 1 2 3 4....  I can do it easily
>> for a single datum, but I can't see how to do it in one fell swoop for
>> a whole list of data.
>> 
>> I have specific applications in mind, so the verb needs to look
>> something like this:  modvalue verb datalist;offset  (although the
>> modvalue x argument could just as easily be among the y arguments).
>> 
>> A specific example might be:   12  verb  datalist;9
>> This would return the values in the first paragraph above.
>> 
>> I had been thinking along these lines:
>> 
>>    mm=. modval | (offset + i.(#datalist))
>>    if. 0 = mm do. mm=. modval end.
>> 
>> But this, of course, does not work.
>> 
>> I would appreciate explicit code only; no tacit expressions.  Much
>> thanks in advance!
>> 
>> 
>> Harvey
>> 
>> ----------------------------------------------------------------------
>> 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