Graham Parkhouse wrote:
>  Why do I think "table" is [so appropriately] the 
>  dyad of u/ (whose monad is insert)?

Over the years, I've grown some sense of the design lurking in J's
orthography.  For example, to me # looks like (A) the number sign, so tally
(count) makes sense and (B) a little net or sieve, so filtering makes sense
(with 0s for holes and 1s for strings; the fact that you can use integers
greater than these is just a insightful generalization).  Or that ` looks
like , but is higher up and  `  is defined as a higher-order analog to  ,
(and also since it's used for chaining it's helpfully non-intrusive).

Often these little recognitions occur in a flash of insight, and while you
can never be certain they're intentional (viz ` vs ,), sometimes they're so
compelling that it would be very surprising if they weren't (viz # as the
number sign = count).  And sometimes I'll learn them from others, like when
Roger pointed out that for the primitives starting with !, all their
informal names similarly start with "f" (! !. !: = factorial fit foreign)
[1].  Either way, when I learn one of these things I'm always hungry for
more.

So yesterday when you said you'd have a "Eureka" moment with / I was very
excited. I started speculating but didn't come up with anything compelling
(though I had some tantalizing inklings).  I've always considered  /  thus:

        f/ y  (insert):  The / is making f "lean into" y; or maybe it's a
little 
                         cannon shooting fs into the perforations of y  .

        x f/ y (table):  This one is fuzzier [2], but / is doing "x by y"
and
                         and the / looks like "all across" or maybe the 
                         (anti-)diagonal of a table. 

But your concept:
   
>  They both represent fundamental rank changing operations, one
>  (contraction) whereby a dimension is absorbed and the rank is reduced by
>  one, the other (cartesian product) whereby dimensions are concatenated
and
>  ranks are summed.

is also very interesting and ties the valences together conceptually.  I
like it.  Of course mnemonics like these are very personal [3] and may not
be intentional.  Of course, if they work as mnemonics, then it doesn't
matter if they were intentional.  

In this case, I'm not convinced the association is intentional.  Roger often
points out that J's insert is superior to APL's reduce (and is so named)
specifically because J's  / doesn't force a rank-changing operation [4].
For example, I've used  ;/ y  with some frequency (of course, like all /s it
changes flavor when 2 > # y, so it's better to use  <"0  or  <">  in
general, even if they feel klunky).

>  All benefits from array manipulation come *only* when 
>  there is a change in rank.

And certainly I don't think you'd find too many takers for this idea.  Is  1
2 3 + 4 5 6  not useful?  There is no change in rank.  

At the very least, array-orientation saves us keystrokes from having to type
"for(i=0;i<n;i++)" all the time.  This is similar to the abstraction from
gotos to structured programming. It takes advantage of the computer's nature
as an uncomplaining automaton; why should I have to repeat myself when the
computer can do it for me? 

Of course, array orientation has benefits other than supporting laziness.
Perhaps the highest being that eventually it helps you frame questions
differently.

-Dan


[1]  ! !. !: = factorial fit foreign  :  
     http://www.jsoftware.com/pipermail/chat/2010-January/002899.html

[2]  "Table" is fuzzier to me probably because I don't use x f/ y much.  
     It is common that f has unbounded rank, so I'd have to change that 
     with  "  .  And if I'm  going to have to use " to get use out of /
     anyway, I might as well skip / (all / does is change f's rank).  

     Of course I don't think about it like this, where I decide to use
     /  then change my mind; it's just that  /  rarely  occurs to me in
     the first place (a sort of slippery slope).  I just frame problems
     in terms of  "  .  

     That said, I got some use out of table yesterday:

 
http://www.jsoftware.com/pipermail/programming/2010-February/018631.html
   
[3]  Discussing APL's symbols, I once had an APLer tell me that the
     symbols aided thought because they "looked like" what they did.
     Let's test that theory.  First, look at this symbol:

       http://www.fileformat.info/info/unicode/char/235d/index.htm

     (It's a horseshoe overstuck with an o.) Now evaluate his reasoning:
     "it's obviously the comment symbol, because it 'sheds light' on 
     the foregoing, and it looks like a lamp!".  You tell me, did you
     think "hey, that looks like a lamp"?  

     Of course, now that I've told you, you can see it.  But that just 
     means the symbols are a memory aid, not a comprehension aid (moreso
     because even if you did see a lamp, I doubt you would've found the
     chain of reasoning "lamps illuminate, as do comments, so it's
     the symbol for a comment).

     On the same topic, I always thought that iota looks like a 
     little duck more than anything else.  But I do regard the reverse 
     and transpose operators as mnemonic (spin around the center
     and tilt over, respectively).  
 
     Similarly I think J's transpose, |:, looks like a little coffee
     table or Stonehenge trilithon tilted over onto its side.

     It might be fun to have a Wiki page to identify mnemonics for J
     primitives.  Or include them directly in the new Vocabulary.

        
[4]  / isn't "reduce": 
     http://www.jsoftware.com/pipermail/general/2010-January/033498.html



----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to