so if it's called monadically, {⍵ ⋄ ⍺⍺} mentions ⍺⍺ which forces it to become monadic, and so (⍵⍵ {⍵ ⋄ ⍺⍺}) ⍺⍺ (⍵⍵ ⍵) calls ⍵⍵ ⍵ and then ⍺⍺ on that, and then calls (⍵⍵ {⍵ ⋄ ⍺⍺}) on that?
ah, okay. i think that's where i'm confused - it looks like it'd call {⍵ ⋄ ⍺⍺} (which from what i understand, since the first statement isn't an assignment/guard/error guard, is like {⍵} or ⊢), and then call ⍵⍵ on the result of that, but that's not what's happening
You could write monadic power operator which uses its left argument as iteration count instead of the right operand, and then defaults to "fixpoint" (f⍣≡) if used monadically:
2×⍣{⍞←'New value is ',(⍕⍺),'. Enough? ' ⋄ 'y'∊⍞}3
New value is 6. Enough? n
New value is 12. Enough? n
New value is 24. Enough? n
New value is 48. Enough? y
48
@hyper-neutrino No, f⍣n is "apply fn times".
You could look at f⍣g and f⍣n as two unrelated operators sharing a symbol if you wanted.
i'm not too familiar/comfortable with it yet because... well, my experience with tacit coding is Jelly which of course has a drastically different design philosophy
The only things missing are 1) if a train is used dyadically, then where you'd have f and g applied on the single argument before, you now gain a left argument. 2) if there's an even number of functions in the train, the leftmost one is applied monadically on the result of the rest of the train.
okay. so basically, if the train is even length, apply the first one monadically to the result of the rest, if it's a single element, apply it to the argument(s), and otherwise, apply the second-to-left function on the result of the first function applied to the argument(s) and the result of the remainder?
i guess it would be clearer to say - x (f + g...) y (where g... also has odd length of course) is the same as (x f y) + (result of g... on x and y) and (f + g...) y is (f y) + (result of g... on y)
@Adám sorry i think i picked that terminology up from vyxal, lol. meant to say if the train just has a single function, but then it isn't really much of a train anymore, is it