> I am having a problem understanding this description.
I think the process can be described by
makeSeq=: 4 :0
s=.0,}.(1 i:~])@(<{:)\x
z=.{.y
for_i. }.i.#y do.
z=.z,(i{y)+z{~i{s
end.
)
transform A to an index array
0,}.(1: i:~])@(<{:)\A
0 0 0 2 3 3 3 6 6 8 2 2 11 12 12 12 15 15 11 18 19 20 18
These indices are used to select an element in the unfolding array C which is
then added to the current element of B.
A makeSeq B
14 30 22 28 33 36 34 50 50 69 35 34 37 38 46 49 66 49 43 48 65 72 52
or as a (un)fold
(],{+ B{~#@])/(|.}.(1 i:~]<{:)\A),{.B
14 30 22 28 33 36 34 50 50 69 35 34 37 38 46 49 66 49 43 48 65 72 52
--
Met vriendelijke groet,
=@@i
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm