Newsgroups: comp.lang.apl
Path: watmath!watserv1!utgpu!csd.unb.ca!morgan.ucs.mun.ca!nstn.ns.ca!news.cs.indiana.edu!sdd.hp.com!think.com!ames!haven.umd.edu!socrates!socrates!rockwell
From: rockwell@socrates.umd.edu (Raul Deluth Miller-Rockwell)
Subject: Re: Expressiveness of Language
In-Reply-To: jph@astro.umd.edu's message of 24 Mar 92 04:53:24 GMT
Message-ID: <ROCKWELL.92Mar24013147@socrates.umd.edu>
Sender: rockwell@socrates.umd.edu (Raul Deluth Miller-Rockwell)
Organization: Traveller
References: <1992Mar20.184205.4943@watmath.waterloo.edu>
	<LIBERTE.92Mar20173238@birch.cs.uiuc.edu>
	<1992Mar23.200055.737@cshl.org> <12056@umd5.umd.edu>
Date: Tue, 24 Mar 1992 06:31:47 GMT

J. Patrick Harrington:
      For now, APL is something to use, and J something of a riddle -
   it should be as powerful as APL, but how do you even translate your
   APL phrases into this strange stuff? Thus I wanted to look at a
   particular value in an array, but in the Iverson books didn't seem
   to have the equivalent of the [ ..] index.

Hmm.. you seem to have skipped over the part labeled Catalogue.  Try
page 13 of the dictionary.

   (And if your arrays are say, 4 x 500 x 800, you don't just look at
   the whole object!) So you try to figure out what to do. Worse yet,
   all the indexing is origin 0. (*IS* there a way to set the J index
   origin to 1? I.e., so that "1{z" would get the first element of z
   rather than "0{z"?)

Well, you've got a few choices.  You could pad your arrays out and
ignore the 0s.  You could derive a function to do it for you, such as
({~<:)~, or what you did below.  Or you could use origin 0 indexing.

      What I finally did was define 
          I =. ({~<@<:)~
   Then, where in Dyalog APL I would type,
                  z[2;3;1]
   I can use
                 2 3 1 I z
   in J. Or, for 
       z[1;;]   I have  1 I z , etc.

That works.  You could also use:
        z{~{1;2;0
or similar expressions, such as
        z{~{ (1+i.2); (2+i. 6); 1+i. 10

      But when you have to struggle to do things like this ... will it
   ever catch on?

I think you're worring about the wrong things.  But even if it
doesn't, it's fun while it lasts...

   Will even APL survive? I think it will, but perhaps not as APL.

It's true that other languages are becoming more APL like.  I see this
as a good thing.

      Astronomers are starting to make a lot of use of IDL
   (Interactive Data Language), which one tends to think of only in
   terms of image display and manipulation. But guess what, folks.
   Images are arrays of numbers, and in IDL you can add, multiply,
   etc. these arrays without any reference to indices, just like APL.
   And IDL is not just a display language, but a full programming
   language - and some people here have it churning away for hours on
   Sun SPARCs, and claim that it's not that much slower than FORTRAN,
   and ever so much more interactive and faster to program - sound
   familiar? So, though I would hate to see it, APL may vanish when
   it's useful features are are silently incorporated into the next
   generation of higher level languages.

Yeah, if APL efficiency and availability isn't improved, as APL, then
other people, doing other things, will do some work in that general
direction.  But there are a lot of useful features in APL, and it
seems like several times that in J.

I think what you're observing is something of an example of how
opportunity and risk are inextricably intertwined.  Or something like
that...

-- 
Raul Deluth Miller-Rockwell                   <rockwell@socrates.umd.edu>
The debt accumulated by the US government today, if measured in
hundred dollar bills, would weigh something over a ton.
