Interesting that my solution only differs from yours in the fifth box where I 
get 31 instead of 32, but irrelevant since it is not correct. 

Looking at your original question you wrote

+/ 2 3 4 5 = (((2+3) + 4) + 5)

but actually J would evaluate right to left.

+/ 2 3 4 5 = (2 + (3 + (4 + 5)))

You can see this better with non commutative dyadic verbs such as -

    (((2-3) - 4) - 5)
_10
   (2 - (3 - (4 - 5)))
_2
   -/ 2 3 4 5
_2

Is it possible that this is the source of your puzzle?

Cheers, bob



> On May 22, 2017, at 7:56 AM, Lafras Uys <[email protected]> wrote:
> 
> Hi Bob,
> 
> Thanks for your reply. For the sequences,
> 
> |41|41 35|41 35 25|41 35 25 18|41 35 25 18 30|41 35 25 18 30 33|
> 
> the expected output is
> 
> |41|39|28|20|32|36|
> 
> so that when you read 36 and all the "ones" in reverse, i.e. 3620891, you
> get the sum of the large numbers, as in,
> 
>   +/ 10 #. "1 T
> 
> 3620891
> 
> It is therefore not sufficient to calculate the carry operations for
> successive pairs of numbers, the carry operation depends on all prior
> carried "tens". Hope that makes sense. In other functional languages I
> would use reduce or a right fold, but / does not seem to behave as a fold.
> 
> Thanks again for taking an interest,
> 
> Lafras
> 
> On Mon, 22 May 2017 at 15:52 robert therriault <[email protected]>
> wrote:
> 
>> Hi Lafras,
>> 
>> It sounds like you don't want the whole sum of the carry's just the sum of
>> the last two in each group. When I use your S as you have defined it I get
>> 
>>    S
>> 36 35 26 16 22 32
>> 
>> then I take the vector overlapping 2 at a time to make a table
>>   2 ]\  S
>> 36 35
>> 35 26
>> 26 16
>> 16 22
>> 22 32
>> 
>> then I apply carry on each row
>>   2 ([: carry/"1 ]\ ) S
>> 38 29 18 23 34
>> 
>> Is this what you  had in mind?
>> 
>> Cheers, bob
>> 
>> ps. (you are the first Lafras I have met. Cool name :-) )
>> 
>> 
>>> On May 22, 2017, at 2:50 AM, Lafras Uys <[email protected]> wrote:
>>> 
>>> L:0 < \ S
>> 
>> ----------------------------------------------------------------------
>> 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