Thanks Jurgen and Kacpur for the explanation. Makes sense. Also thanks to Jurgen for the fix.
Colin On Sun, May 3, 2020 at 10:18 AM Dr. Jürgen Sauermann < mail@jürgen-sauermann.de> wrote: > Hi Colin, > > thanks, see below... > > Best Regards, > Jürgen > > On 5/3/20 2:13 AM, Colin Verrilli wrote: > > I was playing around with using empty arguments with functions to see what > happens. > This one seems to make sense > > ↑ (0↑(1 2)(3 4)),¨(0↑(1 2 3)(4 5 6)) > 0 0 0 0 0 > > Yes. The prototype (0 0) of (1 2)(3 4)) and the prototype (0 0 0) of (1 2 > 3)(4 5 6) are > being concatenated to form the result. > > 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 (and also non-scalar primitives) handle empty arguments > different > from scalar functions. They have to because otherwise you could not write > a defined > function that handles empty arguments > > > This one should probably be a length error or something, but I get a > failure. > > ↑ (0↑(1 2)(3 4))=¨(0↑(1 2 3)(4 5 6)) > > Correct. You now get a length error (*SVN 1278*). > > > ============================================================================== > Assertion failed: A->same_shape(*B) > in Function: eval_fill_AB > in file: ScalarFunction.cc:707 > > Call stack: > > ---------------------------------------- > -- Stack trace at ScalarFunction.cc:707 > ---------------------------------------- > 0x43195865 __libc_start_main > 0x80973E0 main > 0x8200B65 Workspace::immediate_execution(bool) > 0x80F1A4D Command::process_line() > 0x80F149E Command::do_APL_expression(UCS_string&) > 0x80F0C25 Command::finish_context() > 0x80FAB54 Executable::execute_body() const > 0x81B10DD StateIndicator::run() > 0x812CD9C Prefix::reduce_statements() > 0x812C31E Prefix::reduce_A_F_B_() > 0x8101FCC DerivedFunction::eval_AB(Value_P, Value_P) > 0x80C5B26 Bif_OPER1_EACH::eval_ALB(Value_P, Token&, Value_P) > 0x81A2ACC ScalarFunction::eval_fill_AB(Value_P, Value_P) > 0x80AC487 do_Assert(char const*, char const*, char const*, > int) > ======================================== > > Colin > > >