Newsgroups: comp.lang.apl
Path: watmath!watserv1!utgpu!news-server.csri.toronto.edu!rpi!think.com!yale.edu!jvnc.net!darwin.sura.net!haven.umd.edu!socrates!socrates!rockwell
From: rockwell@socrates.umd.edu (Raul Deluth Miller-Rockwell)
Subject: Re: Bug in J 4.1 ??
In-Reply-To: HAC041@DJUKFA11.BITNET's message of 2 Mar 92 15:48:00 GMT
Message-ID: <ROCKWELL.92Mar3005349@socrates.umd.edu>
Sender: rockwell@socrates.umd.edu (Raul Deluth Miller-Rockwell)
Organization: Traveller
References: <92062.154800HAC041@DJUKFA11.BITNET>
Date: Tue, 3 Mar 1992 05:53:49 GMT

Konrad Hinsen:
      op =. +
      table =. op/
      (i.5) table i.5
   results in the expected output
      0 1 2 3 4
      1 2 3 4 5
      2 3 4 5 6
      3 4 5 6 7
      4 5 6 7 8

   Starting J again (to get rid of the definitions) and typing
      table =. op/
      op =. +
      (i.5) table i.5
   (i.e. exchanging the first two lines) results in
      0 2 4 6 8

Yes, the distinction between these two forms is not easy to discern.
However, it is simple in concept.

In a fresh workspace (or, any workspace where 'op' has not been
defined), the function rank of 'op' is infinite:
   -"op
+-+-+-----+
|-|"|+ + +|
+-+-+-----+

However, once you've defined 'op' to be a scalar function (e.g. op=.
+), the rank of 'op' is also scalar:
   -"op
+-+-+-----+
|-|"|+ 0 0|
+-+-+-----+

When you define 'table' several aspects of the definition of 'op' are
effectively fixed, to provide as general a definition as possible.  To
avoid this ambiguity, you can declare the rank of op:
   table=. op"_ 0 0 /

Or,
   table=. op"- /

With this definition, there is no longer any ambiguity about the rank
of op.

-- 
Raul Deluth Miller-Rockwell                   <rockwell@socrates.umd.edu>
