a =. {{ x ] F.. {{ x ] F.. + y }} y }} a 4 : 'x ] F.. {{ x ] F.. + y }} y ' 100 a 1000 2000 3100 100 a 1000 * i. 2 3 6300 7300 8300
I think this is what you asked for. The inner fold is dyadic, so an item is appended to the end of the array before the summation.
To pass in x, use x&{{ }} . There is another way but it is tricky & thus available only to those who have studied NuVoc down to the last detail.
Henry Rich On 12/5/2020 1:58 PM, Raoul Schorer wrote:
Hi, I have a verb such as: v1 =: {{)m a=.L.y b=.2^1-~a c=. (<y)(<0 0 0)}<"0[0$~a,b,4 d=.2&^i.a e=.a$0 ...complicated verb... }} where in complicated verb, I am supposed to have a nested iteration on i.a then i.d and mutate y from v1 on each iteration. I have tried to emulate a nested loop with {{ x ] F.. {{ x ] F.. + y }} y }} but I cannot understand the order of execution. Also, is there a way to reference x from v1 in the nested loop to mutate it? Perhaps nested loops would be the preferred way here? Thanks! Raoul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
-- This email has been checked for viruses by AVG. https://www.avg.com ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm