Of course. If G could be either monadic or dyadic / ambivalent, F⍣G where G is a primitive function and not a lambda would be ambiguous as to the valence of G. I should have thought of that.
Thanks, Louis > On 15 Aug 2016, at 22:10, Christian Robert <[email protected]> > wrote: > > Look at this > > {1+÷⍵}⍣= 256 > 1.618033989 > {1+÷⍵}⍣{⍺=⍵} 256 > 1.618033989 > {1+÷⍵}⍣{⍺=⍵⊣⎕←⍺ ⍵ (⍵-⍺)} 256 > 1.00390625 256 254.9960938 > 1.996108949 1.00390625 ¯0.9922026994 > 1.500974659 1.996108949 0.4951342905 > 1.666233766 1.500974659 ¯0.1652591074 > 1.600155885 1.666233766 0.06607788159 > 1.624939113 1.600155885 ¯0.02478322885 > 1.615407674 1.624939113 0.009531439632 > 1.619038783 1.615407674 ¯0.003631108845 > 1.61765043 1.619038783 0.001388352906 > 1.61818053 1.61765043 ¯0.0005301001708 > 1.61797802 1.61818053 0.0002025099168 > 1.618055368 1.61797802 ¯0.00007734757573 > 1.618025823 1.618055368 0.00002954477659 > 1.618037108 1.618025823 ¯0.00001128500832 > 1.618032797 1.618037108 0.000004310503058 > 1.618034444 1.618032797 ¯0.000001646463698 > 1.618033815 1.618034444 6.288934578E¯7 > 1.618034055 1.618033815 ¯2.402158839E¯7 > 1.618033963 1.618034055 9.175430926E¯8 > 1.618033998 1.618033963 ¯3.504702684E¯8 > 1.618033985 1.618033998 1.338677325E¯8 > 1.61803399 1.618033985 ¯5.113292456E¯9 > 1.618033988 1.61803399 1.953103901E¯9 > 1.618033989 1.618033988 ¯7.460192464E¯10 > 1.618033989 1.618033989 2.849540603E¯10 > 1.618033989 1.618033989 ¯1.088429347E¯10 > 1.618033989 1.618033989 4.157429956E¯11 > 1.618033989 1.618033989 ¯1.587974197E¯11 > 1.618033989 1.618033989 6.065370428E¯12 > 1.618033989 1.618033989 ¯2.316813408E¯12 > 1.618033989 1.618033989 8.850697952E¯13 > 1.618033989 1.618033989 ¯3.379518887E¯13 > 1.618033989 1.618033989 1.290079155E¯13 > 1.618033989 > > power is always diadic on the function it call. > > > Its right argument then is _always_ the result of the previous iteration. > > Is that correct? > > I really hope so. That was my understanding since several months. I may still > be wrong. > > Xtian. > > On 2016-08-15 21:54, Louis de Forcrand wrote: >> I'm sorry, _I_ misunderstood the manual. I did not know that Dyalog dfns >> were always dyadic / ambivalent. >> >> If I understand correctly then, in F {pow} G, G's left argument is _always_ >> the result of the power operator if G is true. Its right argument then is >> _always_ the result of the previous iteration. Is that correct? >> >> If it is, I believe always ambivalent lambdas would be convenient (aside >> from possible implementation problems), but not at all essential; it's >> probably rare to check something about the previous iteration without >> comparing it to the current one. But wouldn't have been simpler to model >> them as ambivalent from the ground up? >> >> Louis >> >> On 15 Aug 2016, at 08:22, Jay Foad <[email protected] >> <mailto:[email protected]>> wrote: >> >>> The manual is here, see page 145: >>> http://docs.dyalog.com/15.0/Dyalog%20APL%20Language%20Reference%20Guide.pdf >>> >>> I'm not sure where Louis got the information about monadic G. I assure you >>> that Dyalog APL does not examine G to see if it's monadic or dyadic. It >>> always tries to apply G dyadically. >>> >>> Jay. >>> >>> On 15 August 2016 at 12:30, Juergen Sauermann >>> <[email protected] <mailto:[email protected]>> >>> wrote: >>> >>> Hi Jay, >>> >>> I see. Maybe I misunderstood Louis,s email from last Saturday completely? >>> The way I read this email was that in Dyalog APL version 15 you can have >>> a monadic condition function G in F⍣G . Quote from the email: >>> >>> >>> ///The Dyalog 15.0 manual states that the power operator can take a/ >>> ///function right argument. In this case, that function can be/ >>> ///either monadic or dyadic, and can be a lambda./ >>> ///If it’s monadic:/ >>> / >>> / >>> /// (F⍣G) ⍵ ←→ ⍵ ← F ⍵ until G ⍵/ >>> ///⍺ (F⍣G) ⍵ ←→ ⍵ ← ⍺ F ⍵ until G ⍵/ >>> / >>> / >>> ///If it’s dyadic:/ >>> / >>> / >>> /// (F⍣G) ⍵ ←→ ⍵ ← F ⍵ until ( F ⍵) G ⍵/ >>> ///⍺ (F⍣G) ⍵ ←→ ⍵ ← ⍺ F ⍵ until (⍺ F ⍵) G ⍵/ >>> / >>> / >>> ///(Note that G is checked before the first time F is executed.)/ >>> >>> I don't know if that statement is correct or not, but if it is then I >>> would prefer to not >>> introduce this "monadic case" in GNU APL for the reasons explained >>> earlier. >>> >>> Thanks, >>> Jürgen >>> >>> >>> On 08/15/2016 10:16 AM, Jay Foad wrote: >>>> On 13 August 2016 at 13:05, Juergen Sauermann >>>> <[email protected] <mailto:[email protected]>> >>>> wrote: >>>> >>>> In "Mastering Dyalog APL" I haven't found the monadic case for the >>>> right function argument >>>> G of the power operator. In that book G seems to be always dyadic. >>>> So the monadic case looks >>>> like a new Dyalog invention. And, if it is defined like you say, >>>> IMHO not the ultimate wisdom. >>>> >>>> >>>> There is no "monadic case". G is always applied dyadically, and if it >>>> happens to be a strictly monadic function then you'll get a SYNTAX ERROR: >>>> >>>> ⎕FX'r←g y' 'r←g>10' ⍝ g is strictly monadic >>>> 2 g 4 ⍝ applying it dyadically gives an error >>>> SYNTAX ERROR >>>> (+⍨⍣g)1 ⍝ power operator tries to apply g dyadically >>>> SYNTAX ERROR >>>> >>>> In general, Dyalog APL /never/ examines a function operand to see >>>> whether it is monadic or dyadic, in order to treat them differently. >>>> >>>> Jay. >>> >>> >
