[Jprogramming] maximum running sum - understanding scan revisited

Mike Day mike_liz.day at tiscali.co.uk
Wed Apr 18 02:24:55 HKT 2007


Sorry - I did not intend to send this to the group.
Mike

Mike Day wrote:
> Thanks.
> I took an age on 149 - just couldn't get the right
> answer, but always got the same one - so hacked away
> at the mrs subproblem - which is most of the challenge
> of course - and only slowly realised that I'd merely
> got in a tangle allowing for Euler's use of index
> origin 1, and had got the stitching wrong between
> elements 55 & 56 (while still getting 100 ok)!!!
> After correcting that, the answer came readily. I only
> came across (well, remembered) Eugene's essay when
> checking that the J/K/APL community hadn't produced
> something as good when considering writing this up.
>
> Despite appearances, the p150 summation isn't as hard.
>
> BTW, and by way of return of compliments, I liked
> your pseudo-prime congruence class stuff for that
> consecutive primes problem.  I don't like the way
> J runs like a superfast TGV when I'm exploring the
> foothills of a problem, and then chokes to a halt,
> can't be interrupted and has to be restarted etc
> as soon as I tentatively add half an order of
> magnitude to the test-problem size.  Same tends to happen when I slip 
> an x: in at the wrong point.
> Perhaps p: needs a bit more extending with some
> possibility of choice of level of pseudo-primeness.
>
> All the best
>
> Mike
>
> John Randall wrote:
>> Mike Day wrote:
>>
>>  
>>> I needed an efficient verb for finding the maximum
>>> running sum of an array.  I seem to have stumbled on
>>> a really good one, which surprisingly appears to be
>>> better than Eugene's J version of a K verb mentioned
>>> in the correspondence below.
>>>     
>>
>> Nice solution, Mike!  I used Eugene's verb to solve #149.  Still have 
>> not
>> done #150, though.
>>
>> Best wishes,
>>
>> John
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>>
>>   
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
>


More information about the Programming mailing list