Apl Language

Now that Unicode support in browsers is decent, I'll try to put the code examples in Unicode characters rather than images. Let me know if there are any problems. (I'm keeping the images for now - feel free to delete if the Unicode characters are sufficiently useful.) -- MarnenLaibowKoser


APL stands for A Programming Language. It is an ArrayOrientedLanguage.

Its character set is a superset of ASCII. This is demonstrated in the following APL code sample:

 [6]    L←(Lι':')↓L←,L       ⍝ drop To:
 [7]    L←LJUST VTOM',',L    ⍝ mat with one entry per row
 [8]    S←¯1++/∧\L≠'('       ⍝ length of address
 [9]    X←0⌈⌈/S
 [10]   L←S⌽(−(⍴L)+0,X)↑L    ⍝ align the (names)
 [11]   A←((1↑⍴L),X)↑L       ⍝ address
 [12]   N←0 1↓DLTB(0,X)↓L    ⍝ names)
 [13]   N←,'⍺',N
 [14]   N[(N='_')/ι⍴N]←' '   ⍝ change _ to blank
 [15]   N←0 ¯1↓RJUST VTOM N  ⍝ names
 [16]   S←+/∧\' '≠⌽N         ⍝ length of last word in name

Reserved words are preceded by a special symbol (called quad).

There are no precedence rules in APL: statements are simply read from right to left. For example,

12 - 3 + 4 yields 5, same as 12 - (3 + 4)

Contributors: DanB (Dan Baronet, or Dan Bernstein?)

While APL is executed right to left, it is read from left to right. -- JimRussell

The intent was to use 'function'al notation i.e. f(g(x)).

Could someone give a list of what the characters in the above example mean? I remember some of them, and a number of them are described in http://www.users.cloud9.net/~bradmcc/APL.html. However, I have no idea what LJUST, RJUST or VTOM mean - I don't believe they are APL primitives, but are either functions written in APL, or else functions from some language which replaces APL characters with alphanumeric strings. -- PaulMorrison


Note that 12-3+4 = 12-(3+4) = 5 is exactly opposite from the way SmalltalkLanguage does it. In Smalltalk, 12-3+4 = (12-3)+4 = 13.
APL was developed by KenIverson who has since gone on to direct his attention to the language J [JayLanguage].

Yes, you needed a special keyboard, and yes, you need a special terminal, since at that time we are talking about VT100 and variants, mostly IBM terminals actually, but I can't remember their names.

I found some keyboard designs in Google. The one I used was similar to the most complex.

Although difficult to get used to, APL was Fun. I know of a large bank in Brazil that had a team of economists just doing what we call today DataMining in APL 20 years ago.

As I understand, if you had an extended APL, you needed an extended keyboard also. IBM must have loved this language at that time.

An APL program to find all PrimeNumbers <= an integer:

 PRIMES : (~R∈R○.×R)/R←1↓ιR
from: http://www.users.cloud9.net/~bradmcc/APL.html

So Apple stole the option key trick from APL? That makes the fact that Windows doesn't use it even more disappointing than it already was.

APL was originally created to DefineDocumentSpecify? the IBM 360...

...and it was close enough to being an actual computer language that an interpreter was implemented for it (and a special type ball on the ibm selectric was created to represent it).

APL was once used to prototype SQL - SQL could be looked at as an attempt to extract the data-storage aspects of APL into a form which is generally useful.

APL is now a dead language: the user community is so small that you almost never hear about it

...and there are so many divergent variants that little is held in common beyond the basic language.

Still, there are lessons to be learned from APL which could benefit even the most cutting edge technologies.

For example: one of the lessons of UML is that it's a mistake to introduce aggregations or multiplicities early on. These are details which are added later. And yet, "object-oriented" languages force you to learn design patterns dedicated to dealing with these concepts. In APL, on the other hand, you can use the same code to deal with 1:1, 1:n, n:1, or n:n multiplicities (yes, n:n is really 1:1 multiplicity, but you wouldn't know that by the way you have to represent it in a classic OO language). n:m (outer join) multiplicities take a slightly different approach, but we're talking a minor syntactic difference here, not a design pattern which requires the creation of several different classes.

When you look at a body of OO code (like .NET, or J2EE), and compare it to a body of APL code (like what you see at http://www.kx.com/download/documentation.htm, you can't help but realize that there are lessons about CodeReuse which we've yet to integrate into the mainstream.

-- AnonymousDonor


Reading Material
AplLanguage QuickQuestions

Q Anyone know where to get a "free" AplLanguage processor that works in WindowsXp, can communicate with a ComComponent (or activex) that has GUI, and also links up to databases via ODBC or OLEDB drivers? Any dialect will do, though I prefer basic APL with ability to remap keyboard to using APL keys

A Did you try http://www.jsoftware.com, home of the "free" JayLanguage interpreter [RandyMacDonald] A Workstation APL2 Time Limited Version of APL2 Last time I looked, the limitation is accumulated CPU time, so one can use this over a period of days, weeks, or months. http://www14.software.ibm.com/webapp/download/preconfig.jsp?id=2002-12-22+21%3A26%3A37.604297R&cat=&fam=&s=p&S_TACT=104AH%20W42&S_CMP= [IBM.com ... Products & services > Software > Software Development] gerry lowry gerry.lowry@abilitybusinesscomputerservices.com (Wednesday 2004-11-03 03:15 Eastern Time)

-- sorry, I do not know the exact time limit ... regardless, because it's in CPU allocation, unless you stuck in a loop, you should get a substantial number of days, weeks, or months to play with it ... as for clean uninstall, I am not that sure ... one would hope that IBM can perform a clean uninstall but unfortunately, I can not speak on their behalf. As for me, I never uninstalled it, so I do not have an answer from my personal experience. -- gerry http://abilitybusinesscomputerservices.com

A I've found NARS2000 at http://www.nars2000.org/ to be a solid player. It's a Windows executable but it does easily run using Wine on Linux as suggested on it's page. See also the "What it's Not" section to know where it's aimed. I certainly have used it to play around and attempt to rekindle my 30 year old skills (and I'm only 45 so what kind of geek does that make me?)
See also JoelMosesOnAplAndLisp, JayLanguage, KayLanguage, AplusLanguage
CategoryProgrammingLanguage

EditText of this page (last edited November 2, 2013) or FindPage with title or text search