Newsgroups: comp.lang.apl
Path: watmath!watserv1!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!avogadro.barnard.columbia.edu!shenkin
From: shenkin@avogadro.barnard.columbia.edu (Peter S. Shenkin)
Subject: Re: Programming in J
Message-ID: <1991Nov10.190838.14635@ctr.columbia.edu>
Sender: usenet@ctr.columbia.edu (The Daily Lose)
Organization: Dept. of Chem, Barnard College, Columbia U, New York
References: <1991Nov9.001252.6288@yrloc.ipsa.reuter.COM>
Date: Sun, 10 Nov 1991 19:08:38 GMT

In article <1991Nov9.001252.6288@yrloc.ipsa.reuter.COM> dgil@ipsaint.ipsa.reuter.COM (Gillett, David) writes:

>     Mark Keil pleads for material that would explain J in terms of "how you do
>things in other languages".  I have some mixed feelings about this.

>  ...People who expect to do an element-by-element
>translation of procedural programs into functional languages remind me of the
>proverbial tourist, who is sure that if he speaks English loudly and slowly
>enough, the natives will figure it out.

>... There is some sense in which J verbs RESEMBLE functions.  But adverbs are
>an important part of J; they're somewhat analogous to adverbs in English and
>unlike any feature in most other programming languages....

>... There used to be (and for all I know there still is) a recurring pattern
>of people learning APL as a notation, and continuing to think and program
>essentially in FORTRAN (or C, or whatever).  The conceptual breakthrough, into
>using APL "as a tool of thought" happened 4-8 months down the road, if ever...


Dave,  In one sense I agree with you.  I actually happened to learn
to program the other way around.  I learned APL first, and used it for
several years before, out of necessity, rather than desire, I learned to use
C, Fortran, and even UNIX.  Therefore I really looked forward to getting
J and learning to use it.  But I found that even with my background
I cannot grok the J documentation or the language.  I spent about eight
hours with it and a working version of the program, and got so frustrated
that I gave up.  In that eight hours I did not expect to learn the language,
but I did expect to learn enough so that I could do a few simple things,
and to bootstrap myself into a position so that I could learn the next
things more easily than the first things.

Telling the user how to do things in J that he already does in other languages
does not mean telling him how to write a DO-loop in J.  It means showing
him how to do in idiomatic J what he now uses a DO-loop for in Fortran.
The mapping isn't one-to-one;  sometimes a Fortran user uses a DO-loop
to initialize an array to 0's, or, say, to the DO variable, so here one
would give the J operations to do these things.  Sometimes it's used to
take dot products, or, in nested form, to multiply matrices; again, one
would show how these things are done with primitive operations in J.

IF()THEN...ELSEIF()THEN....ENDIF constructs also have different purposes
which would be met with different constructs in J.  Examples can be laid
out.

The methods of doing most of the above things are very similar, I gather,
(though please tell me if I am wrong) in APL and in J;  for example, there
is a one-to-one correspondence, or nearly so, between APL's RHO and IOTA
and their J equivalents.

On the other hand, in APL there is a method for indexing into an array to 
set or extract specific subarrays or elements.  I gather that in J some very
different mechanism is used, but I have not been able to figure out from a
combination of the documentation and playing with the program what J's
mechanism is and how it works.

That's why I said in a previous posting that, for me, a useful book might
have a title like "J for APL Users."  For the stuff mentioned earlier, a
useful book might have a title like "J for Users of Procedural Languages."
And I don't think the best person to write such a book would necessarily
be an expert in J, like Hui or Bernecky or Sirlin.  The best person to write 
such a book might be someone who has just learned J the hard way, and still 
remembers what he had to unlearn.  (This goes for technical manuals in general.)

>... I do not claim to KNOW why the J materials take the approach that they do.
>But I can clearly see reasonable arguments for deliberately doing things that
>way, and against providing the sort of "tourist's phrasebook" manual.

Maybe there are folks out there who have either the patience, the 
intelligence or the genetic endowment to learn J given the program and
the existing docs.  All I can say is that so far, I'm not one of them.  
I have a feeling, though, that with different sorts (note, I am not saying 
"better") learning materials, a greater audience might be reached, and that 
people like me might even be a member of that greater audience.

	-P.
-- 
************************f*u*cn*rd*ths*u*cn*gt*a*gd*jb*************************
Peter S. Shenkin, Department of Chemistry, Barnard College, New York, NY 10027
(212)854-1418    shenkin@avogadro.barnard.columbia.edu   shenkin@cunixc.BITNET
********** "I've got algorithm -- who could ask for anything more?" **********
