Friday, December 30, 2011

Hitler Angry At APL Worst Computer Language Ever

Wackiest computer language ever invented was APL. Alas I never had to program in it, but it was on the IBM 5100 desktop computer that for some reason wasn't as successful as the later IBM PC.

The famous comment from Dijkstra, that the APL language is a mistake carried to perfection, probably originated from the fact that at the time this comment was made, no proper language punctuation relating to flow control other than the branch arrow and line label were present in the language.


APL has been used since the mid 1960s on mainframe computers and has itself evolved in step with computers and the computing market. APL is not widely used, but minimalistic and high-level by design, at several points in its history it could have captured a more significant market share, but never did. APL first appeared on large mainframe computers and, like C and Pascal, did find its way to CP/M and MS-DOS based microcomputers. Unlike C and Pascal, APL did not flourish in the microcomputer arena until hardware of sufficient computing power became commonly available. Perhaps accounting for its lack of mainstream appeal, APL's characteristics have always led to much criticism of the language. As always, such complaints may arise from misconceptions, have origins in distant APL history and no longer be relevant today, or they may have some degree of validity.

The Game of Life was about 500 lines of BASIC code. It's trivial in APL:

The following function "life", written in Dyalog APL, takes a boolean matrix and calculates the new generation according to Conway's Game of Life. It demonstrates the power of APL to implement a complex algorithm in very little code, but it is also very hard to follow unless one has an advanced knowledge of APL.
life←{↑1 ⍵∨.∧3 4=+/,¯1 0 1∘⊖¯1 0 1∘.⌽⊂⍵}

Game of Life in APL

Biggest problem was the wierd-ass charcter set and keyboard which required backspace double typing with a selectric with a special typing ball

The IBM 2741 keyboard layout with the APL typeball print head inserted looked this way to the programmer:
Some APL symbols, even with the APL characters on the typeball, still had to be typed in by over-striking two existing typeball characters. An example would be the "grade up" character, which had to be made from a "delta" (shift-H) and a "Sheffer stroke" (shift-M). This was necessary because the APL character set was larger than the 88 characters allowed on the Selectric typeball.


  • (so hard to find speakers of APL these days ;-)
  • :)
  • @gejyspa Actually, that was platform-dependent.. Sorry, what I should have said was
    or ⎕AV[¯1+((⎕AV='A')/⍳256)+3×3+2-­2|⍳3]
  • Seriously? No quad IO? *sigh* Well, all I can say about this video is ⎕AV[3×3+(3⍴10)⊤11*2]


PastCrumbs said...

APL was kinda cool it was like having super powers (in the programming world). A while back I work for a company that repackage statistical data. I was almost fresh out of college. I was not even a very good APL programmer and I actually demolished several large team of "standard language" programmers from the competition in creating new code with new features. It was kinda cool. APL was like having a sports car on an uphill race while everyone else was going to try doing it sitting on an office chair.

Euhill said...

If you think that APL is bad, you should check out Forth. It was not a whole lot better. Forth was like an attempt at turning assembly into a high level language.