At first, I wanted to state strong disagreement. But wait. I still do think the order is counterintuitive, but now I think the way it’s defined is actually better in terms of 'data' vs 'control'.
Let me explain: Folds are a variation on / There’s not much more to it. The main advantage is: x doesn’t need to have the same type/shape as an item of y So a better example would show this. Say v takes an A-structure on the right and a B-structure on the left. In a fold (x1 v (x2 v (x3 v (x4 v y)))) we need x v y to return a B-structure. But that looks more like those B-structures are data and the A-structures control their being transformed by v which is consistent with x to the left and y to the right /and/ with the array processed item-by-item becoming this very x and the initial value becoming y. So if at all, we’d need to spell the example 1 2 3 4 ] F:. see_arg 7 and have F:. work that way – which it does if you introduce some ~ 1 2 3 4 (] F:. see_arg~)~ 7 (I hope that’s correct – these swappings are a bit confusing) I don’t think /that one/ will get much applause. (I’d say let’s do it – but I don’t expect many to agree) Counterintuitive, but for a good reason. Am 23.02.21 um 21:01 schrieb Henry Rich: > x is a 'control' input to the fold. > > Each item of y (and x if given) is a 'data' input to v. > > There's an end on't! > > Henry rich > > On 2/23/2021 2:46 PM, Brian Schott wrote: >> I think I am in favor of Sergey's suggestion. In my excerpted J session >> below I created a verb called test which has the traditional arguments x >> and y to emphasize how I think of the placement of x and y. The x and >> y in the >> verb test are reversed relative to the x and y in see_arg. That's the >> inconsistency. So, I guess I'm one of the 8 people using F: now. <grin> >> >> see_arg =: dyad : 0 >> >> echo x, y >> >> x + y >> ) >> test=: 4 : 'x ] F:. see_arg y' >> test >> 4 : 'x ] F:. see_arg y' >> 7 test 1 2 3 4 >> 1 7 >> 2 8 >> 3 10 >> 4 13 >> 8 10 13 17 >> JVERSION >> Engine: j902/j32/android >> Release-a: commercial/2020-12-24T11:35:03 >> Library: 9.02.08 >> J Android: 1.4.12/9/28 >> Platform: Android 32 (armeabi-v7a) >> Installer: unknown >> InstallPath: >> /storage/emulated/0/Android/data/com.jsoftware.j.android/files >> Contact: www.jsoftware.com >> >> (B=) >> >> On Sun, Feb 21, 2021, 1:53 PM 'Sergey' via Programming < >> [email protected]> wrote: >> >>> Hi! >>> >>> I am glad that in version 9.02 verbs are now executed from right to >>> left, >>> which corresponds to the logic of J. >>> >>> However, in my opinion, the order of passing arguments to the right verb >>> (see_arg in my example) >>> also needs to be changed for the logic of J. >>> >>> see_arg =: dyad : 0 >>> NB. See argument order >>> echo x, y >>> x + y >>> ) >>> >>> Today: >>> >>> 7 ] F:. see_arg 1 2 3 4 >>> >>> 1 7 >>> 2 8 >>> 3 10 >>> 4 13 >>> 8 10 13 17 >>> >>> The proposed order is more logical: left ini value goes to left argument >>> and right array values going to right argument of verb: >>> >>> 7 ] F:. see_arg 1 2 3 4 >>> >>> 7 1 >>> 8 2 >>> 10 3 >>> 13 4 >>> 8 10 13 17 >>> >>> Sergey. >>> >>> >>> >>> On Sun, 21 Feb 2021 07:28:44 -0600, Julian Fondren < >>> [email protected]> wrote: >>> >>>> There's " https://code.jsoftware.com/wiki/Vocabulary/quotem >>>> Common use #2, to make a constant verb out of a noun. >>>> >>>> (_."_)`2:`3:@.] i:2 >>>> 2 3 _. 2 3 >>> Hi Julian, >>> >>> thanks for the hint! This does exactly what I was looking for. >>> >>> Regards, >>> >>> Thomas >>> ---------------------------------------------------------------------- >>> For information about J forums see http://www.jsoftware.com/forums.htm >>> ---------------------------------------------------------------------- >>> For information about J forums see http://www.jsoftware.com/forums.htm >>> >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm > > -- ---------------------- mail written using NEO neo-layout.org ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
