APL in its modern state (2020)
sacrideo.us
sacrideo.us
[1] https://github.com/peportier/jelm
[2] https://dl.acm.org/doi/10.1145/3315454.3329960
[3] https://futhark-lang.org/blog/2016-06-20-futhark-as-an-apl-c...
[0] http://help.dyalog.com/14.0/Content/UserGuide/Images/Languag...
APL was near-mainstream in the 1970s thanks to time-sharing[0] (the article mentions this starting with "APL thrived in the 70's and 80's"). In fact, time-shared APL was significantly easier to use than most languages because it was used from an interactive session rather than punch cards. With results typed onto paper tape! It was used for a lot of practical tasks like administration where Excel would now be the most common tool. One book on APL had sales in the hundreds of thousands, and conferences[1] had attendance of over a thousand for a few years, despite competing with additional vendor-specific conferences.
So here I sit in front of a then very fancy 3279 terminal writing my little APL programs to do what they wanted - mostly extract/reformat/summarize data from one sort of file format to another. Was this a particularly good fit for APL? Not really, but if all you have is a hammer...
Anwyay one day I poked around in other APL code that was on the system and visible to me, and ran one program and wham... the screen on the 3279, which to that point I'd only known as a nice colour text terminal - exploded into fancy graphics. Mind blown. How did they do that? I never found out, because the program that did that was, as you say, "write only" - it looked like screenfuls of random noise.
But yes, APL was used in the mainstream, at least in the IBM internal world, as late as the mid 1980s. Maybe the use was artificial - you know, train new cohorts of co-op students in it and make them use it for real work - as a sort of dogfooding, don't know.
Not true. I can still touch-type APL, decades after my last use of the language and I don't have an APL keyboard.
Those complaining about typing being difficult or the funny symbols are not thinking this through.
What's the difference between typing English (or another language) on a computer keyboard without looking at it and typing APL.
None. Exactly zero.
If you don't learn how to type without looking at the keyboard, typing any spoken language is a slow grind.
How long does it take to learn to touch-type, say, English? Not too long. It takes effort and dedication that is well within the skills and mental capacity of 99.999% of the people who use computers. APL is no different.
Of course, you can't go from touch-typing English to touch-typing Greek or Japanese after a few sessions with a card in front of you. It takes work. You have to learn it. And then it's easy.
When I got started, in the early 80's, we would put stickers on the keys, buy a set of replacement keycaps or a ready-made APL keyboard. After not too long the keyboard no longer mattered. I, and everyone else I knew who actually used APL for more than a curious exploration, could touch-type APL on a normal keyboard without any custom labels or keycaps at all. As I said above, I can still do it, decades later.
(I do keep forgetting which keys I have ψ and ξ on in Greek: the illogical C and J. Maybe I should make stickers.)
For a period of time, custom font ROMs or typeballs were harder to improvise than custom stickers; although the PLATO IV and V terminals had both softfonts and overstrike, very few were ever made, and both features were entirely missing from more common hardware, like the IBM 2741, Diablo daisy-wheel printers, Epson MX-80, ADM-3A, VT-100, VT-220, Heath H-19, IBM MDA, Hercules, and even the CGA. In 01986, in the Microsoft shill magazine PC Magazine, Charles Petzold touted this killer new feature of the US$524 EGA: "Even with 64K [video RAM], the normal font is replaceable by software." (March 25, 01986, p. 115.) The TI-99/4A and Nintendo Famicom did of course already use programmable "character generators," but I don't think anyone ever offered APL for them. Eventually, of course, we all moved to framebuffer displays backed by cheap semiconductor RAM, so custom fonts were no longer a premium feature.
I think the "font problem" really was a significant issue for APL adoption during the period 01968–01988, and as it turned out, that was a crucial formative period for computers; that was when we got, among other things, the PDP-8 (and thus process control computers), Unix, TCP/IP, C, the Macintosh, the IBM PC, MS-DOS, spreadsheets, object-oriented programming, semiconductor RAM, computer animation, digital music synthesizers, TeX, Intel and its 8008/8080/8086/80386 line, the primacy of ASCII, the 68000, ARM, RISC in general, and the modern IDE. Of these, only MS-DOS and the 68000 have really fallen out of favor.
There are a lot of path-dependent things in computing that we can attribute to standards established during that time. If IBM hadn't had their head so far up their ass, or if VisiCalc hadn't been written until 01986, things might have turned out very differently for APL.
Yup. Used those. I had a PC rigged with a toggle switch and a custom little wire-wrapped board to be able to switch character ROMs. I even wrote printing utilities to be able to pause and swap out the IBM printer's type ball when printing documents that required a mixture of APL code segments and regular text. I wrote a custom hybrid text editor in APL for precisely this purpose, to be able to do application notes that included both character sets.
> I think the "font problem" really was a significant issue for APL adoption during the period 01968–01988
Yes, agreed. The bit of APL history casual observers miss is that Iverson's motivation for transliterating APL symbols into J was exactly this problem. He tried to solve a business/financial/adoption problem. As a result, he bifurcated and confused the APL world. He was wrong to make this decision. And, what ended-up happening was that both languages became oddities rather than what APL could have become with the capabilities of next generation hardware.
That and the cost of licenses. As a student I got free licenses but it was hard to justify what some of these packages cost. STSC's, I think, was the lowest cost most popular version used by most of the university types I used to engage with. IBM's version had penetration into business because of their position with mainframes. Once again, splitting the ecosystem did not do anyone any favors. J is an abomination (it defecates all over Iverson's own seminal paper on the power and value of notation as a tool for thought).
APL had many issues that truly needed resolving. Simple things like the object oriented programming and heterogenous data types would have been very interesting to explore. The other thing may have been providing official means for avoiding O(n^2) issues where just a few innocent looking operators would result in converting vectors intro matrices or >2 dimensional arrays and then having to do all that processing when a simpler procedural option that does not expand to consume all available memory would have been great. In some ways this is the world of Python and numpy today. You can work at various levels of abstraction and be reasonably aware and in control of resources and computational complexity.
One of Stallman's first jobs was writing a text editor in APL in the 01960s.
The most prominent such dialect is BQN, which I definitely recommend anyone interested in APL-like languages to take a look at. https://mlochbaum.github.io/BQN/
APLwiki has a list of other languages: https://www.aplwiki.com/wiki/Language_overview#Dialects
Disclaimer, I'm the developer of one of these dialects so of course I'm biased.
Edit: this has been posted on HN before.
https://news.ycombinator.com/item?id=23055793
"Is APL Dead? Not anymore"
APL dialects April[0] and KAP[1] are improving rapidly, and my own offshoot BQN[2] has gone from prototype to a full language. All of these are open source and made to work with the Unix ecosystem. While the K language isn't as close to APL, ngn/k[3] is following a similar trajectory.
This year we created a Discord/Matrix forum[4] (bridged together) for array languages, which has hundreds of members and a few conversations per day at the slowest. The Array Cast was featured prominently here when the first episode aired[5] and is also worthy of note: they say they now have thousands of subscribers.
[0] https://github.com/phantomics/april
[1] https://github.com/lokedhs/array
[2] https://mlochbaum.github.io/BQN/
[3] https://codeberg.org/ngn/k
I'm sure that writing a greenfield APL program is a lot of fun. Initially.
Or if you're just writing vignettes to do some temporary data wrangling then it's fine.
As a language for writing applications that do proper work and need maintaining? Wouldn't be in my top 50 choices of language. And I don't think I've worked with 50 languages yet.
But those languages are astonishingly intimidating for new programmers -- reading from right to left, with implicit variables, different usage of brackets, types that are hard to discern, overloading of every possible bit of punctuation, etc makes it more like translating Latin than writing code.
So while a line such as : .[`:/data/raw; (); :; 1001 1002 1003]
is very succinct, the skill and concentration necessary to write that line is not something that lends itself to widespread adoption.
if you like terse generic code you'll be fed for a while (too much even, Aaron's two page parser/compiler was somehow too cryptic even for my tastes :)
That parser was mind bending.
I've been livestreaming a presentation tool / time-travelling REPL for J for a few months now:
https://github.com/tangentstorm/j-prez
It hasn't paid anything directly yet, but my videos probably helped me land my current job.
At work, I use another APL-inspired language called K.
Like, if it has actual uses and implementations on modern machines and isn't abandonware, someone is going to be using it somewhere.
But I would say it was niche.
I've also heard Forth and Lisp described this way. And yet I find both readable since I have experience using them. I wonder if APL is similar: It's only unreadable to people who don't know the language. Well of course it is.
Take the famous 'game of life' APL example:
``` life ← {⊃1 ⍵ ∨.∧ 3 4 = +/ +⌿ ¯1 0 1 ∘.⊖ ¯1 0 1 ⌽¨ ⊂⍵} ```
It's quite logical, when you walk through it.[0] But it's harder to read 'back to front', which is what code readability is about.
https://www.youtube.com/watch?v=pMslgySQ8nc&t=45s&ab_channel...
And he even shows how you can animate it in the editor window.
In other languages it’s easier to communicate “why” you are doing something, while in APL it’s the “how” that’s easiest.
result←findMax data
max←0
:For i :In data
:If i>max
max←i
:EndIf
:EndFor
result←max
then findMax 5 1 2 3 5 6 3 1
6
Writing it more neatly as findMax←⌈/ isn't mandatory anymore than `reduce(max, numbers)` is mandatory in Python.But I remember what confused me the most was trying not to use loops to sum arrays and using vector ops like +/A
Forth and Lisp were odd, like a native English speaker learning Russian or Korean. APL is like writing a novel directly into encrypted form.
I firmly believe languages like APL, Forth and LISP should be taught in a single quarter course on programming languages. The perspective you get is invaluable. These ideas help you think about computational problem solving in a different way.
That said, attempting to use any of these languages today for anything other than a fun hobby would be a mistake. While APL isn't dead --paid and free distributions are still actively maintained--, it is, in my opinion, deader than a doornail when it comes to the reality of using it for any real work, particularly at scale. In this sense it isn't any different than Forth, LISP, COBOL and FORTRAN. Can you imagine Facebook announcing a move to FORTRAN. Neither can I.
I often find the comments on HN about APL is terribly misinformed. Things like "read only language", "need a custom keyboard", "need a custom machine", etc. are, from the perspective of someone who actually knows APL, just silly. People truly should stop for a second and think about whether their opinions about anything are based on enough data to actually support even having an opinion. Simple parallel example:
Dabbling in music does not make you a musician. Declaring that you need a custom machine to type musical notation and that this notation is impossible to read would sound terribly ignorant to someone who devoted sufficient time to actually learning and internalizing this.
I can, still, to this day, decades later, touch-type APL. Do you look at your keyboard when you type anything in your spoken language/s? No? Same with APL. The learning curve isn't any worse than learning to type on an ASCII keyboard. Do you have to look at the keyboard when you type any of the shifted symbols on the top row? No? Well, imagine that's APL. Different symbols. No problem.
Yes. APL is dead as a sensible informed choice for non-trivial projects.
No. APL is not dead as it pertains to learning some amazing things about what computing could --and arguably, should-- look like at some undefined point in the future.
I have always thought that the future of AI will require us to be able to communicate with the computer in code in a form far closer to the symbolic APL approach rather than typing words in English. I can't put my finger on what form that would take. Iverson's "Tool for Though" paper goes over the reasons that support this idea. I just can't offer anything other than to say I believe this to be true based on ten years using an amazing symbolic language for real work at scale. One of my APL applications was part of the human genome decoding project. It helped analyze, classify and visualize sequencing data.
Given that Fortran is used all the time for numerical computations, especially in science, and this very site runs on LISP, I'm not sure you're making the point you think you are making.
Not counting "it would be nice if you had exposure to these languages."
A job, where you are required to primarily develop software using these languages. That's the criteria.
-----------------------------------------------------
Monster.com
"apl software engineer" results: 0
"fortran software engineer" results: 0
"lisp software engineer" results: 0
-----------------------------------------------------
Linkedin:
"apl developer" results: 1
"fortran developer" results: 0
"lisp developer" results: 0
"python developer" ~50,000 results (no, did not bother to filter through the list to get down to actual python jobs vs. mentions)
"c++ developer" ~100K (same comment)
-----------------------------------------------------
Oh, no, I am making precisely the right point. HN running on LISP is a rounding error. FORTRAN for scientific computing is also a rounding error. These things are dead.
https://stackoverflow.com/questions/tagged/apl 266 questions
https://stackoverflow.com/questions/tagged/fortran 11,855 questions
https://stackoverflow.com/questions/tagged/forth 262 questions
https://stackoverflow.com/questions/tagged/python 1,817,529 questions
https://stackoverflow.com/questions/tagged/c++ 741,496 questions
LISP: 6,615
javascript: 2,285,941
java: 1,805,413
c#: 1,503,129
php: 1,417,981
etc.
If "underwater_basket_weaving" was a tag it would likely get more questions than APL, Forth and LISP combined.
Let it go...
This, a million times. It’ll open young minds like nothing else.
Is APL an interesting language that most people would benefit from picking up and building something with? Sure.
Is there a small and passionate community around it? Absolutely?
Is it still possible to get up and running with APL in 2021? Yes.
Given the variety of choices in the developer ecosystem is APL the best choice for the types of problems the vast majority of developers are solving today? No.
And I think maybe most interestingly this conversation (to me) highlights how important ecosystems, frameworks and communities are to modern development over the pure language semantic benefits.
I.e. is it still the best tool for the job it was designed for but on modern hardware/OSes? Provided you don't mind the special charset and low availability of APL programmers to maintain your code.
It had much better facilities than any other language for working with arrays of numbers but other tasks were awkward, e.g. handling strings, input/output, program control structures, partitioning a large program in separate modules and so on.
So going back to use the original APL is not a solution.
On the other hand, having to work with arrays of numbers in any language that does not include APL-like expressions is tedious. Having to write explicit loops when better solutions existed more than half a century ago seems extremely stupid.
With Unicode, providing the APL operators in a programming language is trivial.
There is however one APL feature that prevents the simple extension of any current programming language to just allow you to write APL expressions without changing the language otherwise.
APL had a different rule for the precedence of operators than most popular programming languages, all operators have equal precedence and the right hand operand of an operator is everything that is to its right. So the operators are evaluated from the right to the left, unless there are parentheses to change the order.
This rule was a very important innovation of APL. While it may seem weird for those who do not have experience with it, it is actually much more convenient than the usual multi-level precedence rules.
Just adding APL operators to a language without also using the APL rule of evaluation order would loose a good part of the APL advantage and simplicity.
Am I the only one who finds this "[question]? [answer]." comment format hard to read/digest?
Would it be less awkward to simply write a statement as a sentence? Yes. :-)
Turns out people love array programming but hate terse syntax.
[0] https://dev.to/bakerjd99/numpy-another-iverson-ghost-9mc
Languages like R are both easier to for the average programmer to read and (much) easier to type.
People hate Java and COBOL and XML and PowerShell and ActionScript and SQL for their verbose syntax. People adore `x ? y : z` while complaining about unreadable terse syntax that with symbols that don't say what it does in English. Why do people put up with data[4] to get an item out of an array with a special single-purpose symbol heavy syntax instead of index(data, 4)? How come the symbols are never the problem when people are familiar with them?
Can it just as easily be explained by "people like what they're used to, people hate change"?
That’s not APL. It’s all ASCII.
One of the issues I experienced in college was being unable to verbally communicate APL code to colleagues. We called the comment symbol “finger”.
If you don't know the name of ":" then you can't verbally communicate it to a colleague, and saying "it's ASCII" doesn't mean you magically know its name. If you know that ⍝ is called "lamp" then you can verbally communicate it.
"It's bad because I don't already know it" feels like a weak kind of criticism.
The tl;dr is that while you have to learn a few more symbols, the benefit of that is they're so composable you don't have to learn anywhere near as many keywords, because they can be defined in just a few characters.
I'm repeating myself in hopes it becomes obvious that learning the symbols is not needed in other languages because the keywords are already the names we would need to learn anyway and, usually, also make it easy to derive their meaning.
Think of how you read code in an unknown language - you look for patterns you usually see and use the names of keywords and variables to understand both what's being done and why. With "vintage" APL, the symbols are opaque and you are left looking for patterns you probably won't be able to identify without first understanding what the symbols mean, because both syntax and alphabet are unknown.
APL has like 80 builtin glyphs, compared to hundreds or thousands of functions in stdlibs of traditional languages, and when you learn those 80, you can read & write all of APL (and the terseness means you can consume information much faster, and knowing all of the language vastly simplifies the writing process too - you might not need to learn all of a traditional language to read it, but writing one well still needs a very big coverage of knowledge, or constant docs lookup).
Sure, for someone who knows C-like syntax, Java is infinitely more readable than APL, but if you bother to learn APL, it's pretty simple.
The line is fine.
1. Learning curve - most of the people immediately dismiss what they can't intuitively understand straight away, even if it requires just some minutes to grok and a cheatsheet during first days of usage. People need to have at least very basic clue immediately to get interested and feel motivated to invest further attention.
2. Terse syntax/vocabulary encourages packing overly complex logic into one-liners which become brainfuck to read and reason about even for yourself shortly after. I believe it's not hard to develop automatic decoders for such expressions which would split them into multiple lines introducing intermediate variables, structure them with indentation and/or highlight corresponding elements but people probably prefer to just read the code immediately rather than to use advanced tooling even to read it.
I indeed adore `x ? y : z` and similar things and use these heavily but always split the expressions in separate indented lines every time I nest them.
Some times I also use ReSharper to convert some verbose C# code I wrote into much shorter (Linq or something) but in not-so-rare cases I then fail to understand the result and have to remember/comment what does it do. I would often revert to verbose unless I'm sure this part of the code is not going to need to be debugged ever after.
Some languages (I'm thinking of Rust's Result/try/? syntax) have gradually evolved some parts of themselves from verbose to terse as people became more familiar with the concepts, so I would not be surprised if Python/NumPy follows a similar path.
Python only added a symbol for matrix multiplication ("@") in version 3.5, probably because many of its _current_ users are already familiar with the concept.
When Python was first introduced, it seemed to be more of a Perl or Bash replacement, so dedicated syntax for matrix multiplication would have been weird.