50 years APL

For friendly off topic discussion not covered in a forum above.
Forum rules
No politics, please.
User avatar
Oskar45
Posts: 2258
Joined: Mon Dec 05, 2005 2:35 am
Location: Vienna, Austria

50 years APL

Unread postby Oskar45 » Wed Apr 27, 2016 7:57 am

Some of you might have heard about it and a few of you might even have programmed with it. It's one of the oldest programming languages still in use. Yes, it's certainly not a pure functional language at all - but neither was LISP [BTW - at that time the concept of a pure functional language was not even on the horizon]. Don't know how many of you work today with pure functional languages. In 1978, Backus asked whether programming could be liberated from the von Neumann style. Well, the answer today still seems to be a resounding "NO" - C [IMHO a complete disaster] is apparently growing strong as the lingua franca of programming ...

APL. I started with it in the late 70's as consultant and then used it in my day-to-day job as sysadmin for 20 years or so before we succumbed to C. It is terse, sure, but that's the problem of the user :-)
Everyone loves a lover. Romeo loves Juliet. Therefore, Trump loves Putin.

User avatar
tomvos
Donor
Donor
Posts: 136
Joined: Fri Jul 04, 2008 1:08 pm
Location: Aachen, Germany, Europe
Contact:

Re: 50 years APL

Unread postby tomvos » Wed Apr 27, 2016 8:51 am

I never learned APL, but if I should ever have some free time, this is one of the languages on my personal short list (besides Haskell and Prolog).

BTW, my favorite monospaced font - PragmataPro - even has has ligatures which make APL look terse and beautiful at the same time.
:Fuel: :Octane2: :O2: :O2: :1600SW: :Indy: :Indy:
Where subtlety fails us we must simply make do with cream pies.

User avatar
R-ten-K
Posts: 1889
Joined: Mon Nov 15, 2004 10:36 pm
Location: Nor Cal

Re: 50 years APL

Unread postby R-ten-K » Wed Apr 27, 2016 2:10 pm

I'm trying to figure out what a sysadmin could possibly use APL for...
"Was it a dream where you see yourself standing in sort of sun-god robes on a
pyramid with thousand naked women screaming and throwing little pickles at you?"

robespierre
Posts: 1578
Joined: Mon Sep 12, 2011 2:28 pm
Location: Boston

Re: 50 years APL

Unread postby robespierre » Wed Apr 27, 2016 2:57 pm

APL was used heavily by financial analysts (quants) in the '70s and '80s. Today if you write in APL you may be confused for the Zodiac Killer
:PI: :O2: :Indigo2IMP: :Indigo2IMP:

User avatar
Oskar45
Posts: 2258
Joined: Mon Dec 05, 2005 2:35 am
Location: Vienna, Austria

Re: 50 years APL

Unread postby Oskar45 » Thu May 12, 2016 6:21 am

@tomvos: You will like it - but don't forget there is APL2 as well. Nevertheless, although its AP998 makes a Prolog-like inference processor available to APL2 programs, leave out Prolog - it's not a pure functional language. Take up Haskell instead [a good start might be Bird, R.: "Introduction to Functional Programming using Haskell", Prentice Hall].

@R-ten-K: E.g., managing workspaces on the system level or writing interfaces to DBs - both of which demanded access to sources our 'normal' users didn't have.

@robespierre: Ah, the usual cliche [it's like saying LISP is only useful for AI].


APL doesn't need any defender - I'd be biased anyhow [Kenneth Iverson - who had received the ACM Turing Award one year after Backus and well before Ritchie & Thompson - and I were friends, and for some years even worked for the same employer].

What we know today as APL [A Programming Language] is just a partial implementation of Iverson's original notation for describing effectively 'algorithms' [he called them 'programs', though]. In fact, he'd used it for illustrating the description of the IBM 7090 at the programmer/system designer level [an APL2 description of a 3090-class machine was given much later]. Actually, it would probably be an interesting exercise to describe, say, a Fuel in the same spirit. A bit of trivia: the very first workspace (IBM's <1 CLEANSPACE>) was saved on 11/27/1966 at 22:53:59 GMT, with 1656K.

IBM's APL2 for the IBM PC and IBM PS/2 - almost identical to the IBM APL2 Release 3 host mainframe Program Product - run under DOS and included about 40 function symbols; with the exception of 'Execute' and 'Bracket Indexing', all could be used dyadically and the majority also monadically. There were some APL dialects with less or more function symbols, or even with different symbols/names for basically the same function - e.g., 'Enclose'/'Box'. However, what doesn't seem to be widely known: there were APL versions which allowed you to dispense with the function symbols altogether and just write your code with keywords only. Of course, for me reading programs written only with keywords is an awkward nuisance - but your mileage might differ :-)

APL is most certainly not an ideal programming language, but then again THE ideal language hasn't yet been devised and probably never will. I've learned to deal with its shortcomings and after almost 40 years am still using it gladly…

As a sidelight - there's another programming language probably none of you have ever used or even heard about: Q'Nial. It combines (heaven forbid :-)) APL and LISP, albeit only keywords, no function symbols. It's a beauty. And of all the reference manuals I've encountered, Q'Nial's was by far the best. It's a pity that Q'Nial sank into oblivion.

Finally, just morsels of fun: suppose you are a consultant discussing technical business with a client. The talk turns to solving linear equations of decent sizes. Chances are you don't have an appropriate program ready on your laptop. You say, "no problem, I'll code it overnight". Fine. I'd take out my HP 200LX - and provided the batteries hadn't died - and fire up IBM APL2, key in an one-liner and get the solution in a blink. And the job...

...and paraphrasing Laotse:When the superior man hears of APL, he practices it. When the ordinary man hears of APL, he ignores it. When the inferior man hears of it, he laughs at it. If it were not laughed at, it would not be true APL.
Everyone loves a lover. Romeo loves Juliet. Therefore, Trump loves Putin.

tingo
Donor
Donor
Posts: 319
Joined: Sat Jun 26, 2010 5:40 pm
Location: Oslo, Norway

Re: 50 years APL

Unread postby tingo » Wed Jun 08, 2016 3:13 am

Back when I worked in IBM, an older colleague told me that one reason APL got popular within IBM back in the days, was because it gave you interactive access to the machine. At the time, everything else was batch processing (submit job, get the result the next day, fix errors, repeat).
I never learned APL though.
Torfinn

robespierre
Posts: 1578
Joined: Mon Sep 12, 2011 2:28 pm
Location: Boston

Re: 50 years APL

Unread postby robespierre » Tue Oct 11, 2016 5:50 am

The terseness of APL is very interesting; it achieves this not only with single-character functions, but powerful higher-order operators.

Conway's Game of Life in a single line of APL

This APL program is dizzyingly compact:

Code: Select all

⏂′⎕′,∈Nρ⊂S←′←⎕←(3=T)∨M∧2=T←⊃+/(V⏀″⊂M),(V⦵″⊂M),(V,⏀V)⏀″(V,V←1 -1)⦵″⊂M′
:PI: :O2: :Indigo2IMP: :Indigo2IMP:

User avatar
Oskar45
Posts: 2258
Joined: Mon Dec 05, 2005 2:35 am
Location: Vienna, Austria

Re: 50 years APL

Unread postby Oskar45 » Thu Oct 13, 2016 5:57 am

robespierre wrote:The terseness of APL is very interesting; it achieves this not only with single-character functions, but powerful higher-order operators.

Conway's Game of Life in a single line of APL

This APL program is dizzyingly compact:

Code: Select all

⏂′⎕′,∈Nρ⊂S←′←⎕←(3=T)∨M∧2=T←⊃+/(V⏀″⊂M),(V⦵″⊂M),(V,⏀V)⏀″(V,V←1 -1)⦵″⊂M′

Unfortunately, your code snippet doesn't show some symbols properly. Check the above link for the real picture. Actually, to be precise - it's not APL but APL2 (APL didn't have enclose/disclose/each/enlist - see Iverson, 'A Dictionary of APL' [1986]). And as far as it goes, it's a rather trivial one-liner. In fact, on my HP200LX under DOS 5.00 I can run it with APL/2 [ca. 1988] and not a too a big input without problems [otherwise I get WS full].
Everyone loves a lover. Romeo loves Juliet. Therefore, Trump loves Putin.

robespierre
Posts: 1578
Joined: Mon Sep 12, 2011 2:28 pm
Location: Boston

Re: 50 years APL

Unread postby robespierre » Thu Oct 13, 2016 9:39 am

You can't program using GIFs of symbols, so that's a pretty useless response. Unicode doesn't have a single range of APL symbols (only the boxed characters are specifically for APL), so there are naturally going to be differences in how systems render the different characters. If you have suggestions of better Unicode encodings for that code I would appreciate it.

I have referred to a popular source for the Unicode points (wikipedia) and updated this accordingly:

Code: Select all

⍎'⎕',∈N⍴⊂S←'←⎕←(3=T)∨M∧2=T←⊃+/(V⌽¨⊂M),(V⊖¨⊂M),(V,⌽V)⌽¨(V,V←1 ¯1)⊖¨⊂M'

I'm not sure that the aesthetics are improved, but there's some hope it will render properly on more computers.
Last edited by robespierre on Thu Oct 13, 2016 4:18 pm, edited 1 time in total.
:PI: :O2: :Indigo2IMP: :Indigo2IMP:

User avatar
kjaer
Posts: 427
Joined: Wed May 07, 2008 7:47 pm
Location: Seattle, WA
Contact:

Re: 50 years APL

Unread postby kjaer » Thu Oct 13, 2016 12:33 pm

I've been playing with APL a bit lately. It's growing on me, but I'm far from proficient.

For a slightly less shocking example (the opposite direction from obfuscated perl style submissions), here's a function I wrote using the trial division process to find the first n prime numbers.

∇ PRIMES N;FOUND;COUNT
[1] FOUND←1⍴2
[2] COUNT←3
[3] START:→(N=⍴FOUND)/END
[4] →(0∈FOUND|COUNT)/NEXT
[5] FOUND←FOUND,COUNT
[6] NEXT:COUNT←COUNT+1
[7] →START
[8] END:FOUND


I found it easier to grok, at least in terms of solving simple problems, than, say, FORTH.
:OnyxR: :IRIS3130: :IRIS2400: :Onyx: :ChallengeL: :4D220VGX: :Indigo: :Octane: :Cube: :Indigo2IMP: :Indigo2: :Indy:

User avatar
skywriter
Posts: 3292
Joined: Fri Mar 14, 2003 5:22 am
Location: Trump-proof bunker
Contact:

Re: 50 years APL

Unread postby skywriter » Fri Oct 14, 2016 5:40 pm

@kjaer, FORTH was one whacked out language. I wrote a MIDI sequencer in FORTH on an Atari 1024. The whole 'screen' thing struck me as arbitrary.
:Skywriter:

DECUS Member 368596

User avatar
kjaer
Posts: 427
Joined: Wed May 07, 2008 7:47 pm
Location: Seattle, WA
Contact:

Re: 50 years APL

Unread postby kjaer » Fri Oct 14, 2016 10:46 pm

Tell me about it. I haven't even gotten to the editor and "screens". I had a hard time getting past the reflex to use named variables. I never even figured out how it might be possible to declare a variable as a side-effect of executing an arbitrary word, since the compiler immediately attempts to fetch the execution token of the word you are trying to define as a variable.

Once I got into the idea of defining my own vocabulary for everything, even if it was for doing something as simple as 2*, and keeping everything I could possibly care about on the stack... (and the corresponding idea that if you want to store a value somewhere off the stack, you are expected to reference it by location and not by name) it got a lot easier I made a lot more progress.

Which FORTH was available on the Atari ST?
:OnyxR: :IRIS3130: :IRIS2400: :Onyx: :ChallengeL: :4D220VGX: :Indigo: :Octane: :Cube: :Indigo2IMP: :Indigo2: :Indy:

User avatar
vishnu
Donor
Donor
Posts: 3189
Joined: Sun Mar 18, 2007 3:25 pm
Location: Minneapolis, Minnesota USA

Re: 50 years APL

Unread postby vishnu » Sat Oct 15, 2016 1:36 pm

Oskar45 wrote:...and paraphrasing Laotse:When the superior man hears of APL, he practices it. When the ordinary man hears of APL, he ignores it. When the inferior man hears of it, he laughs at it. If it were not laughed at, it would not be true APL.


I've never used it but Edsger Dijkstra said "APL is a mistake, carried through to perfection. It is the language of the future for the programming techniques of the past: it creates a new generation of coding bums." which is good enough for me... :lol:
Project:
Temporarily lost at sea...
Plan:
World domination! Or something...

:Tezro: :Octane2:

User avatar
commodorejohn
Posts: 658
Joined: Tue Oct 02, 2012 1:22 pm
Contact:

Re: 50 years APL

Unread postby commodorejohn » Sat Oct 15, 2016 9:30 pm

Anything that Dijkstra doesn't like must have some merit.
Computers: Amiga 1200, DEC VAXStation 4000/60, DEC MicroPDP-11/73
Synthesizers: Roland JX-10/SH-09/HS-80/MT-32/D-50, Yamaha DX7-II/V50/TX7/TG33/FB-01, Korg MS-20 Mini/ARP Odyssey/DW-8000/M1, Ensoniq SQ-80, E-mu Emax HD/Proteus-2, Casio CZ-5000, Moog Satellite, Sequential Circuits Prophet-600

User avatar
Oskar45
Posts: 2258
Joined: Mon Dec 05, 2005 2:35 am
Location: Vienna, Austria

Re: 50 years APL

Unread postby Oskar45 » Sun Oct 16, 2016 4:39 am

@vishnu: To paraphrase Niels Bohr, "If someone says that he can think about APL without becoming dizzy, that shows only that he has not understood anything whatever about it."
Everyone loves a lover. Romeo loves Juliet. Therefore, Trump loves Putin.


Return to “Everything Else”

Who is online

Users browsing this forum: No registered users and 2 guests