I've completed the coding task under which I've raised
narrow questions in threads 'nonsequential 1s' and
'laminating contents of a box-list'. Thanks, all, for
the help. Yes, I needed my attention brought to core
primaries such as ; and ,. but the project as a whole
still went pretty smoothly. The amount of time it
required is somewhat sobering, but I know I have to be
able to write code, period, before I will be able to
write code quickly.

The result of my exercise follows:

maxss=: 3 : 0
AS =. ;(|:&.>) a:, ((] #/"_1 1:) [: >: i.)&.> >: i. #y
IM =. I.@:(>./ = ]) AS (+/ . *) y
y (] # *) ;{. IM{AS
)

Given a list of integers, this returns the first 
contiguous sub-sequence within that list for which the
sum of values is the maximum possible. The empty set
is considered to lead this list of possibilities.

A fair amount of code was written, then thrown away,
in the course of producing an answer I found
satisfactory. The processes of revision were valuable
to me. I've gained better familiarity with how J
dampens the tendency for existing code to stand as a
body to be tweaked. Instead, stability seemed to occur
where it should, at the conceptual level of
problem-definition. I also discovered that the
simplest solution I could devise was a good deal
faster than one I thought would optimize calculation.


TBH


      
____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to