Roger Hui wrote:
tsum3=: 4 : 0
d=. ((</[EMAIL PROTECTED]) y) -.&.> i=. ~.y
while. 1 do.
c=. #&>d
j=. (*c)#i
i=. c#i
e=. ;d
t=. i +//. e{x
if. 0 *./@:= t do. x return. end.
x=. (t+j{x) j}x
d=. i <@;/. (j i. e){d,a:
i=. j
end.
)
That is significantly faster than I anticipated.
(and, considerably more complicated than tdiff,
but that complication is intrinsicly a part of this
problem.).
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm