From: emclean@sfsuvax1.sfsu.edu (Emmett McLean)
Subject: Re: What's J, etc.
Organization: San Francisco State University
Date: Tue, 22 Dec 1992 18:19:44 GMT

To: dbrownfi@magnus.acs.ohio-state.edu
Subject: Re: What's J, etc.
Newsgroups: comp.lang.apl
Organization: San Francisco State University
Cc: 
Bcc: 

In article <9212221607.AA27593@top.magnus.acs.ohio-state.edu> you write:
>It has been a long time since I've programmed with APL so I have a few 
>questions:
>     1. What's J?

      Basically, J is like an ASCII version of APL except that
      some of the old APL instuctions have been generalized
      or rationalized. (Actually some would argue that some
      of todays implementations of APL, having an OOP
      orientation and *lots* of open communication features
      are *worlds* apart, but speaking from the point of
      view of an old APL'er ..). J is both a pure functional programming 
      language and an explicit programming language. Both languages
      have the strong point of being program-at-the-speed-of-thought 
      and list-at-a-time processing languages.

      J is very portable and runs on all popular platforms,
      VAX , NeXT, MAC, IBMPC, Atari, Sun Sparc, and HPLX to
      name a few. 

      At this point you won't be familar with J syntax, but here are
      to verbs (aka functions) for you to look at:

      This one calculates the legendre polynomials:

   factors =. (%~ (-@<: , <:@+:))@ {.@$ 
   last2   =. (,&0@{. , 0&,.@}.)@( _2&{.)
   legendre =. ,.&0 , +/@(last2 * factors) 
   basis =. =/~@i. 2

   So we can run legendre as:

   legendre ^:4 basis 
       1     0     0     0     0     0
       0     1     0     0     0     0
    _0.5     0   1.5     0     0     0
       0  _1.5     0   2.5     0     0
   0.375     0 _3.75     0 4.375     0
       0 1.875     0 _8.75     0 7.875

   (The basis is 1 0
                 0 1)
 
   And written as a verb not refering to any other verbs :
   l=. ,.&0 , +/@((,&0@{. , 0&,.@}.)@(_2&{.) * (%~ (-@<: , <:@+:))@{.@$)

   And the primes found by determining if any of the numbers between
   1 and sqrt N divide N :

   ph =. (#~ (1&=)@(+/)@(0&=)@(|/~ i.@>:@<.@%:)"0)@(>:@+:@i.@>.@-:)
 
   Also, J includes a DOS extender and lets you build graphical
   user interfaces for applications.

   **
   You can get J from watserv1.waterloo.edu .  In the path
   "languages/apl" or "languages/apl/j" you may find Dr. Dickey's
   writeup What-is-J of interest. You'll find the executable
   version of your program in "lanugages/apl/j/exec/*" .
   (And if you're a C++ bug, you can compile the source code
   on your machine. Oh yes, J allows calling to compiled C programs.

   Documentation is available at     

   Iverson Software Inc
   33 Major Street
   Toronto, Ontario, M5S 2K9 
   (416)-925-6096
   FAX (416)-488-7559

   For $34 ($24 + $10 handling) you get "The Dictionary of J",
   comprehensive and concise description of commands, and
   "An Introduction of J" a useful booklet with many useful
   examples.

>     2. Is there a shareware/PD APL interpreter available for MS-DOS?

      Yes, at watserv1. Check out the file apl-j for details.

>     3. Has anyone ever come up with an APL compiler?

      From what I understand, much of Manugistics APL compiles.
      I don't know about IBM's product APL2.

      Also, IBM is beta testing a APL to C translator. Translated
      C programs run as fast as their C counterparts.

  I suppose I'll save this message since the question keeps poping up!

  Hope this helped,

  Emmett emclean@sfsuvax1.sfsu.edu
Newsgroups: comp.lang.apl