Comment by tluyben2
3 years ago
I like APL (and k/j). Problem is, outside trading (and even there it's a niche), it is just not popular enough. This also because most people dismiss it as line noise / write only programming language; that's usually only people who never used it or used it briefly saying that. But it's hard to promote anything that has a reputation like that.
What is a fairly interesting observation (more people have made it, including Arthur Whitney); being able to reason about a program for which you can see all the code on one A4 without having to clickthrough into functions, search, browse through files, classes or even having to scroll is incredibly powerful. All you need is the cheatsheet (provided in your article) (which you know by heart in no time flat) and the program, which, often fits on 1 A4 or less. Modern example of that would be Aaron Hsu his 17 LoC parallel APL compiler[0] (from his thesis).
The reason you give (write only programming language) is indeed ONE of the reasons people may give when discussing about array-languages, and it is actually a serious reason to consider. Having spent much time on it as well as on J, I hope not being part of those "only people who never used it or used it briefly" because I would also add another reason, more important to me.
APL emphasizes some "formal external beauty" (of code) over the true beauty of an algorithm. Of course you can do such or such thing in 2½ characters of APL code rather than 60 boring lines of whatever language you want but it is generally full of unneeded hidden loops (or looping uselessly on whole parts of arrays when only a small part is required). Actual complexity of these "elegant" APL solutions is generaly insane.
On the other hand, the J language has a set of some "optimized" idioms -if I remember correctly. Not sure the thing is really better: "write it that way by pretending you are following the array-way-of-life; of course it would be insane to actually do it that way, but my engine will detect the very specific thing you want to do and will use a state-of-the-art algorithm for that purpose". Not sure it is a good thing because the task becomes over complicated: knowing the true (boring) algorithm, knowing the specific array-syntax encoding that algorithm, which falls back to looking in some "list" of what is optimized or not.
While I agree these languages are fascinating to think about computing, learn new things, etc. I finally went to more or less agree with Dijkstra (not the worst reference?) about these languages being "a mistake, carried through to perfection".
What is wrong about writing well commented, well indented, 30 lines of code if I can implement the exact algorithm that way?
> What is wrong about writing well commented, well indented, 30 lines of code if I can implement the exact algorithm that way?
Nothing, it's just interesting and I wish I could do a larger project with one of them outside just playing around.
Ironically, APL has won as a programming language. Look at the SIMD instruction set - it's APL!
Vector instructions came around roughly at the same time as APL, though.
Can you elaborate on that?
They're both array operations, even comparisons. No branching.
> This also because most people dismiss it as line noise / write only programming language
Not so. Anyone who says these things simply does not know APL. It's like saying musical notation is write-only. Sure, if you don't know it reading the darn thing is excruciating. Yet, if you do, you can see music on the page.
What APL is not is a low-skill, low-knowledge language. A casual glance at the language isn't enough to know it. Just as you can't internalize musical notation without dedication, work and experience.
Back in the '80's I used APL professionally for about a decade. From that context, it reads like music. To this day I can read it just fine (though not as quickly). Interestingly enough the same is the case musical notation, which I could read without thinking twenty years ago, when I was studying and playing classical guitar and piano with great regularity.
That said, I would not recommend anyone get serious about APL today. Study with some degree of dedication? Yes, I think that would be of value. Real projects? No. Definitely not.
Lots of programming isn't math or logic, its shovelling data and manipulating strings. Is APL good at that?
If a string (or a file or whatever) is "just" an array (of bytes; characters, again: whatever), then yes.
If that means "you don't get much more than what C offers", then I'll take that as a no. I18N, Unicode, Regex, built-in string manipulation functions, character set conversions and efficient data structures are table stakes at this point.
7 replies →
> All you need is the cheatsheet [...] and the program
Or an interactive cheatsheet website[1], where you can paste APL code, and mousing over symbols gives their definitions?
[1] http://I-wish-this-existed-but ...
https://tryapl.org/