95

When I was at University 30 years ago, I used a programming language called APL. I believe the acronym stood for "A Programming Language",

This language was interpretive and was especially useful for array and matrix operations with powerful operators and library functions to help with that.

Did you use APL? Is this language still in use anywhere? Is it still available, either commercially or open source?


I remember the combinatorics assignment we had. It was complex. It took a week of work for people to program it in PL/1 and those programs ranged from 500 to 1000 lines long. I wrote it in APL in under an hour. I left it at 10 lines for readability, although I should have been a purist and worked another hour to get it into 1 line.

The PL/1 programs took 1 or 2 minutes to run on the IBM mainframe and solve the problem. The computer charge was $20. My APL program took 2 hours to run and the charge was $1,500 which was paid for by our Computer Science Department's budget.

That's when I realized that a week of my time is worth way more than saving some $'s in someone else's budget.

I got an A+ in the course.


p.s. Don't miss this presentation entitled: "APL one of the greatest programming languages ever"

8
  • 6
    The tag "functional-programming" doesn't suit this language. Just because a language has functions doesn't mean it's a functional language. The tag "numerical-computing" is a stretch. Just because matrices contain numbers doesn't mean the language has tools for precisions and error estimates. Feb 5 '09 at 4:41
  • 8
    I find it tough to believe that a computer science department would have paid $30k to run one student's program; that's more than most students' yearly tuition today, and tuition has been growing faster than inflation for a while. I also find it tough to believe that it would cost $30k for a few hours; that sounds more like the price for a month of time than a few hours worth, and a quick Google search provides me some evidence to back up that intuition: www-03.ibm.com/ibm/history/exhibits/mainframe/… Jan 5 '10 at 6:20
  • 5
    Brian: That was a long time ago, and maybe you're right and I'm an order of magnitude too high. I'll lower them. But it was all "funny money" that Departments didn't really pay since the University owned the computer. Sometimes it was real. When working for the provincial government, one employee accidentally left a program running with an infinite loop in it and left off the time limit in the JCL. It was running all weekend and before someone canned it, there was a charge of $22,000. That was real money that went from one government agency to another. He got in a lot of trouble for that.
    – lkessler
    Jan 5 '10 at 7:41  
  • 5
    look at this! a bunch of drooling old-timing APL nostalgiacs! nice read though. Makes me feel like there were computers and programming before I was born :)
    – jrharshath
    Jan 9 '10 at 18:42

31 Answers 31

104

This popular poem should give you an idea of why APL is not popular anymore:

'Tis the dream of each programmer
Before his life is done,
To write three lines of APL
And make the damn thing run. 
3
  • 2
    Thank you. I enjoyed that.
    – lkessler
    Nov 11 '08 at 23:08  
  • 27
    Then there's that other APL rhyme :) Rho, rho, rho of X / Always equals 1. / Rho is dimension; rho rho, rank. / APL is fun! Apr 25 '10 at 20:08
  • 1
    That was lovely. Jun 26 '11 at 6:18
76

The link below is a to an 8-minute video implementing Conway's "Game of Life" -- including a live-running display -- using Dyalog APL. If nothing else, it should show that the comment questioning the "functional-programming" tag was way off base.

http://www.youtube.com/watch?v=a9xAKttWgP4

4
  • 6
    This video is superb! It shows APL off in all its glory and will give even those who've never heard of APL before, an understanding of its power and how exotic it is. A must see!! I wish I could give you 10 upvotes for pointing it out. ++++++++++1
    – lkessler
    Nov 20 '09 at 5:26  
  • 2
    Also see "Conway's Game of Life in one line of APL" at: catpad.net/michael/apl
    – lkessler
    Jan 5 '10 at 3:28  
  • 6
    This is exactly the sort of brilliant question and answer that would be closed as "not appropriate for stackoverflow" in five minutes these days. Sad, because this is a beauty of a question and a great answer.
    – Warren P
    Aug 28 '12 at 3:22
  • 3
    And nine months later the transformation of Stackoverflow into a place completely intolerant of Important questions was complete.
    – Warren P
    Aug 3 '13 at 3:53
44

From: If programming languages were religions...

APL would be Scientology - There are many people who claim to follow it, but you've always suspected that it's a huge and elaborate prank that got out of control.

3
  • 2
    +1 for the link
    – Eric
    Apr 5 '11 at 15:22
  • 1
    All hail Xenu, mighty coder.
    – Warren P
    Aug 28 '12 at 3:23
40

It was "reimplemented" without all the special symbols as J:

http://www.jsoftware.com

If you specifically want APL IBM has an implementation (registration required). The link I have is:

http://www14.software.ibm.com/webapp/download/preconfig.jsp?id=2007-05-01+08:49:37.264028R&cat=&fam=&s=z&S_TACT=104AH%20W42&S_CMP=&st=1&sp=20

(if that is broken search for "APL download" on http://www.ibm.com/us/en/)

5
31

The hype-meter that goes with discussions about the relevance of various programming languages should be subsumed under the single question raised by the author of APL: how efficient is your programming language as a tool of thought?

In this regard the "why" behind APL's design is far more important than whether a programming language is structured, requires semi-colons at the end of every line or swamps the user in a recursive sea of brackets.

For example I was comparing an old Windows DOS command for deleting all the files in a directory with a scripted equivalent the other day - the modern version required typing over 50 times more code to achieve the same outcome. How is this a measure of progress?

What I clearly recall from the days when I used APL is that if I could solve any problem visually in my head (usually in the bath) I could go to work the following day, write the visual transformations down as a series of APL operations and it would just work.

There was no translation required, no memory management, no structured code to bother about and having to think about avoiding the evil use of "go to" statements - well, this was a complete irrelevance.

All I had to do was to focus on the problem. Yahoo!

APL was been the one (and so far only) language I have come across that just never got in the way of solving a problem.

One would have hoped that after 50 years of creativity we would have had something even more efficient and easier instead of the completely pointless debate about the symbols the language used instead of what they achieved.

Contrariwise we have done a remarkable job of focusing on the production of ever more complex languages that focus nearly exclusively on the Von Neumann architecture rather than on the way we actually think.

So we end up throwing our productivity into the bin by having to juggle three problem domains in our heads (a) the original probem (b) the problem as restrcutured to fit Von Neumann architecture (c) the mapping rules needed to translated back and forth between (a) and (b).

A great way to make projects take at least three times longer than they need to.

How would you rate your programming language as a tool of thought?

http://awards.acm.org/images/awards/140/articles/9147499.pdf

2
20

APL was brilliant for the technology of the time. At that time, both serial bandwidth and memory space was extremely tight. Most terminals output to paper, not to video monitors. Baudrates were 75, 110 and 300. An APL workspace was 32K on the System\360, and the one we had at my JC supported 80 online APL terminals. Every character sent or stored cost precious space and/or bandwidth and/or paper, so the fact that the language was a terse set of symbols was what made it so effective in that environment.

It was the first language I ever learned, and I still love it. I have a version I wrote for the PC that even emulates the overstriking of the keystrokes, as that made the keyboard simple (otherwise you have zillions of combination symbols all over the place). It's an anachronism now, but it has a soft spot in my heart. I still use it for doing desk-calculator type operations on my computer. I wish I could get a real 2741 terminal with APL keyboard to restore and hook up to it but they are now very rare beasts (and heavy monsters too). Oh well, fond memories.

Some still think that APL was ahead if its time, but I'm afraid they misunderstand much of what made it truly great in its heyday.

There has been an attempt to bring the language up to date with the language "J" which isn't dependent on the special symbols (which IMHO, was a large part of what APL had going for it). The result is a language even more unreadable than APL. The language R may be the current future of matrix languages, though I'm sure that's a controversial subject. J and R are free though, and there are some APLs out there, most are not good projects for the uninitiated, as unless you understand the original intents and contexts its hard to use an old APL executable and understand what's going on with it...

20

Is this language still in use anywhere?

Yes, it's used by e.g. SimCorp, "a provider of highly specialised software for leading fund and investment management companies, pension funds, banks and insurance companies".

It's also, like Peter says here, used by Profdoc to create the electronic health record system used in almost all of Stockholm, Sweden (including the renowned Karolinska University Hospital). And I'm in fact one of the developers of this system as of today.

Is it still available, either commercially or open source?

Dyalog Ltd offers a commercial APL implementation (Dyalog APL) for Windows, Linux and other platforms. It includes some "modern" features such as Unicode, object orientation and .NET.

11

I used to write APL apps, back at the dawn of time.

Look into the A+ language, invented and used at Morgan-Stanley for financial applicaitons.

3
10

You may be interested in this piece of APL computer history. Between 1969 and 1976 I worked at the American Stock Exchange and then SIAC after the IT departments of the 2 exchanges merged.
My resume has the following entry: Designed, developed and implemented the first working model of the national stock exchange for SIAC, the computer facilities management and planning organization for the New York, American and regional stock exchanges, formed in 1972 to reduce redundant automation expenses. Presented model to members of US Congress, boards of directors of the exchanges and its members end of entry That model was built in APL by some very good APL folks who worked for a company that had almost all left-handed employees. There was an Allen Rose, a younger guy - Kevin, who actually did most of the programming. As a subject matter expert, I worked as the business analyst. One of the ideas we came up with was to show multiple exchanges and compare the prices being traded on the floor against a back office model that looked at price performance and rules adherance. We needed to tie several computers together to get this all to work and so we were among the first to use the shared variable. I remember Kevin having a tough time to get it to work and was quite happy when he figured it out. I believe we were working with a real time service company and so we had to have several terminals signed in in order to drive our various displays. It was all quite impressive and provided an excellent sounding board for discussions. At one presentation I asked a US senator what he thought about it and that prompted him to send 3 of his staff members the next day to get more details. Thank you Ken Iverson.

2
  • 4
    please email me the APL formula for making money in the stock market. :-)
    – lkessler
    May 20 '10 at 16:06  
8

Yes, Bubba. Thanks for reminding me. I loved that keyboard. Especially the greek letters over AWER (that rho was so powerful!) and the Z through N set operations. although I forget now what the ones over the B and N mean't. Keyboard Diagram http://upload.wikimedia.org/wikipedia/commons/thumb/9/9f/APL-keybd2.svg/600px-APL-keybd2.svg.png

4
7

My first paid gig was developing "expert systems" derived from mathematic model in APL which was actually a pretty fit. I was hooked after encountering a one-liner to solve Rubik's cube!

I don't regret spending almost a year of my life hacking APL because programming in a radically different way, learning strange symbols, thinking in terms of matrix manipulation, using right to left precedence, blurring of programs and data, workspace persistence, really changes how you think, even when faced with "modern" block oriented languages.

Having come across a few APL videos recently, I'm finding the APL Wiki a good place to rediscover what always was a fun tool. At worst you could think of it as "Brain Training" for coders.

1
  • 1
    You got me curious, and I was able to find the Rubik's Cube solution in APL here: nyx.net/~anon84c2 - They didn't implement it as a one-liner and did make it semi-understandable (so un-APL-ish), but you get the idea.
    – lkessler
    Nov 18 '09 at 23:15  
6

We are still using APL. APL2000 has created a full .NET implementation of APL. I Love the language. We use the APL2000 APL+Win product. There is also a Mac implementation from MicroAPL.

6

APL was Iverson's brain child. Iverson was an IBM Fellow which gave him carte blanche in the research center. APL absolutely was a numerical language -- that was one of its objectives; to be very efficient and numerically intensive. The notation was all around the concept of vectors and vectors could be of any dimension. The good implementations were designed to take advantage of advanced computer architectures - pipelining, parallel, highly-register-based and with lots of "core" memory.

The linear algebra was used in a lot of modeling for 'live' simulations, stochastic processes, successive approximations, AI rules, etc. At University of Massachusetts, it implemented on a Cyber 7600 running KRONOS which was the precursor to the Cray Super computers.

Although it was interpretive, the language symbols represented some very complex operators. It was a prefix notation and every operator had monatic and diatic operations -- meaning that its function could operate on either a left-hand, right-hand or left- and right-hand vectors.

The power and elegance lead to some very sophisticated solutions and there are even puzzles and challenges between APL experts.

I loved APL and would be programming with it in a heartbeat if it were available to my class of projects.

5

People couldn't convince keyboard makers to adopt it.

2
5

Boy this brings back memories! Does anyone rember the book **APL, an Interactive Approach ** by Leonard Gilman and Allen J. Rose?

I used to work for STSC in White Plains, NY. I was interviewed by Allen Rose, who was a great guy. When I went for the interview I did not know APL. The interview consisted of questions like "If I told you this operator did this and that operator did that, what would be the result of this line of code?"

Anyway if memory serves me he hired me on the spot. Before that I had been a COBOL programmer, so it was quite a change. Those were the good old days when they were more interested in if you could think than what you knew about programming. They knew they could always teach you a new language, but it's hard to teach someone to think.

ANd the ideomatic expressions! Do you rember using the 1 (take) of the 0 (reshape) of a variable? That was how you determined if a variable contained a string or a number.

1
5

See dYALOG APL.

It is used in life critical hospital information systems, e.g., TakeCare at Karolinska University Hospital and many more companies.

4

For the open source version of GNU APL2 see here

1
4

I really enjoyed APL, back in the far when. It is super high level. At best it treats arrays as objects, not as sequences, giving a view "orthogonal" to the usual one, and lets operators work globally on a whole structure at once. This is a great aid to conceptualization.

So one use of APL was to breadboard a complex numerical or array-manipulating application. The brevity of the code was a real advantage, since an app that would take several pages of ordinary code would often condense to a few lines of APL, and give you new ideas as well. Examples:

  • determine whether a string is a pangram (contains all letters of the alphabet). In APL this takes just 5 symbols.

  • solve the Wonderword puzzle, familiar from daily newspapers. In APL, no more than a dozen lines, as I recall.

One pastime of APL programmers at the time was "one-liners," programs that solved a whole problem in one line of code. Of course this is just playing around, but the range of problems that could be handled this way was amazing.

Thanks to Charlie Martin for mentioning A+, which looks very much like a modern implementation of APL.

4

The video, The Origins of APL, is rather interesting. It's a community television panel discussion about the history of APL from about 1974. The panel includes Kenneth Iverson, as well as several other people involved in the early history of APL. Quite interesting, and the suits and facial hair are to die for.

2

Gtani's answer led me to find info about APL2.

That led me to find that ACM has a SIGAPL group and they still have APL conferences.

IBM has workstation versions of APL2 but does not list the price of their APL2 product, possibly meaning its too expensive for you and me.

Is there a freeware or open source version available?

1
1

I haven't thought about this in a while!

http://en.wikipedia.org/wiki/APL_(programming_language)

1

Insurance actuaries are fond of it because it is well matched to their problem domain.

1

It was fun, but treated too much like an academic exercise.

4
  • 1
    That's its problem. If you understand APL, you can write one liners that are incredible, but just try to document what/how it's doing for someone else, especially someone with lesser APL skills.
    – jsfain
    Nov 21 '08 at 14:39
  • 3
    I did one combinatorics assignment that took me an hour to code in APL. It took 30 minutes of execution time on the IBM mainframe to get to its solution. Other students took a week of their time to write it in PL/I. It took the computer 30 seconds to execute that. Gotta love the tradeoff!!!!
    – lkessler
    Nov 25 '08 at 6:14  
1

www.apl2000.com has details of APL+Win & Visual APL (www.aplnext.com)

Visual APL is a C# peer language, works with Visual Studio 2008 as its IDE.

1

Click here to obtain a free evaluation copy of VisualAPL for Visual Studio 2008.

Click here to learn about the immediate-mode, interactive "Cielo Explorer" session included with VisualAPL in which you can use C# [and VisualAPL if you like array-based programming] to explore the .Net Framework. With the "Cielo Explorer", you don't have to build a Console Project to see results right away.

1

People couldn't convince keyboard makers to adopt it.

This is a fair point, and seems to be a common complaint (it is in fact my main complaint). With all these new fangled touch-screen computers, has anyone created a touchscreen keyboard for APL for any of the IDEs?

1

APL was originally designed as a more sensibly designed alternative to standard mathematical notation. Rather than using infix symbols for some operations, superscripts for others, and so on, there was a standard format for monadic (unary) operations and another for dyadic (binary) operations. The language was later implemented as a computer programming language.

The language is still in use today. There are a number of vendors, including IBM, but commercial version can be rather expensive for individuals. If you just want to try the language out, you might look at the experimental freeware version NARS2000 (http://www.nars2000.org/). This is compiled for Windows, but is said to run on Mac OS X or Linux using the Wine Windows emulator.

For more information, look at the comp.lang.apl newsgroup, e.g. under Google Groups. Ken Iverson, the inventor of APL, later created a second language called J that was intended to rectify what Iverson saw as design errors in the original APL language. J uses ASCII characters rather than a special character set, so J scripts are easy to print or email. The J interpreter is a free download from http://www.jsoftware.com/

I used APL extensively in the past for statistical calculations. Currently I use J from time to time. It is a very powerful language that is easy to use. The interpreter provides a package manager that can be used to download add-ons, such as a database system, packages to convert between J arrays and CSV text files, mathematical and graph plotting packages, and more.

0

i used APL2 on some monstrous IBM mainframes, it's still out there:

http://www-01.ibm.com/software/awdtools/apl/

the other implementation, STSC, seems to have gone invisible in google..

0

This is a bit off-topic, but the profdoc website was giving me a .NET 500 error screen.

I have seen that APL has been ported to .NET, but still - irony.

Insurance actuaries are fond of it because it is well matched to their problem domain.

That sounds about right. A lot of the symbols seem to match stuff used in accounting.

2
0

There's some good APL stuff at http://www.softwarepreservation.org/projects/apl (the top page isn't well-linked, so dig down).