On Sun, 3 May 2020 at 12:16, Kacper Gutowski <mwgam...@gmail.com> wrote: > > On Sat, May 02, 2020 at 08:13:17PM -0400, Colin Verrilli wrote: > >This next one I'm not sure about. Theoretically, it should give the > >same result as above, but maybe the behavior is different for defined > >functions. > > ↑ (0↑(1 2)(3 4))f¨(0↑(1 2 3)(4 5 6)) > >0 0 0 > > ⎕cr 'f' > >z←l f r > >z←l,r > > > >The APL2 LRM makes a big deal about each function having a corresponding > >"fill function" that is used when the arguments are empty. It's not clear > >about what happens with defined functions. > > Defined functions are necessarily different as automatically determining > what the function does and what are its properties is not trivial (and > not possible in general case); it's a similar problem as with reduction > of an empty vector. > > Figure 20 at page 110 of the Language Reference shows that for > “defined operations”, the fill function is “Z←R (the identity function)”. > Note that the description of dyadic each also refers to this this table, > and the table clearly says to use right identity, which is what your > example shows happening.
Interesting. Dyalog APL is different: if you apply f¨ to empty argument(s), it applies f once to the prototypical items of the argument(s) to determine the prototypical item of the result. I'm not sure what NARS2000 does. Jay.