The argument to 4 u\ y will be entirely y, and u is monadic. you can do something like this though:
2 (3&+)\ i.5 3 4 4 5 5 6 6 7 If you can change your spec to "updating y" on every iteration, and you want to apply to: x1 u (x2 u y) then you can make a table where x1, x2 and y are the 3 rows, and then call with u/. You can search for boxscan in archives for method where x and y are not the same shape. This is generally preferable to trying to keep a side effect between calls (so you don't need to worry about initializing it) ________________________________ From: Jon Hough <[email protected]> To: "[email protected]" <[email protected]> Sent: Tuesday, December 2, 2014 7:58 PM Subject: [Jprogramming] Modifying x inside Infix If y is a list and I have a dyadic verb u, which I want to apply to every 4 items of y I can do x ( 4 u \) y and this will apply x u to every 4 items. But I want to continually update x every iteration. So after doing x u y to the first 4 items, x becomes the result, i.e. x =: x u y How do I do this for all the list? I tried things like result =: leftArg ( 4 (leftArg =:) u \ )rightArg but I can't get the correct syntax (assuming there is a way to do this). (I hope my explanation made sense.) Thanks. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
