4 ms·
In Praise of APL (1977)
- kholis_ab 10mo agoi love APL, but never ever tried it ... only watched videos of code_report
- abrudz 10mo agoI'll be happy to give you a live personalised intro in https://apl.chat https://apl.chat or head over to https://challenge.dyalog.com/ https://challenge.dyalog.com/ for an automated guided introduction (with a chance of winning a prize).
- kholis_ab 10mo agowow, thanks a lot! but my english is not good enough for a live "discussion" unfortunately :( But maybe later, if you allow, I will contact you!
- jodrellblank 10mo agohttps://tryapl.org/ https://tryapl.org/
- kholis_ab 10mo agothanks for this link!
- ofalkaed 10mo agohttps://xpqz.github.io/learnapl/intro.html https://xpqz.github.io/learnapl/intro.html is a good place to start learning.
- kholis_ab 10mo agothanks for the link!
- singularity2001 10mo agoShould be the ultimate final incomprehensible programming language for code agents
- ofalkaed 10mo agoChatGPT is pretty good at correcting my mistakes. Give it a snippet of not quite working code with no explanation and it almost always correctly identifies what I am trying to do and explains where I went wrong. Its corrected code almost never works but its explanation of why my code failed gets me my answer and that is what I really want. A year ago it could not help me in the slightest, it has improved quite a bit. The biggest issue with AI and APL seems to be that it does not quite understand the differences between the various versions of APL and seems to view APL2, Dyalog and GnuAPL as all the same language. Edit: It probably would be useless to someone at all competent in APL and whose problems are more complex than their own failings.
- deleted 10mo ago[deleted]
- adrian_b 10mo agoTrue. Due to its lack of verbosity, APL is not at all forgiving for any substitution or transposition in its symbols, which can cause great differences in program output, so it is quite improbable for LLMs to generate a working program, unless it is identical with one from its training set. What I have said matches exactly what another poster said about his experience in using a LLM with APL: "Its corrected code almost never works". The LLM recognizes the problem that must be solved by the code, but it fails to generate the right APL symbol string. I doubt that here a coding agent that attempts to verify the generated code by compiling it can help, because the LLM will generate eventually some syntactically-correct symbol string, but which will implement a different function than desired. Only a complete feedback loop, with a battery of varied tests for the executable program produced by the generated code, which can verify if it really implements the desired functionality, can be used to filter the results for a working program. APL is greatly superior to almost all programming languages that are popular today, for writing expressions involving arrays (this includes expressions that do not involve arrays in other languages, but which could be made simpler by using arrays in APL). However, the original APL has defects, due mainly to the fact that it was an incomplete programming language, e.g. when compared to the other contemporaneous IBM language, i.e. PL/I. What one needs is a programming language with modern program structures, data types and data type definition facilities, but also with an expression syntax matching the power of APL expressions. The fact that in 2026 most programmers continue tho write "for" loops for handling arrays, instead of using array expressions like it was possible in 1966 in APL, 60 years ago, seems an aberration of history. Even in the 1966 PL/I one could use array expressions, even if only expressions that were much simpler than those of APL. Using symbols instead of keywords, like in APL, is not cryptic for anyone who uses such a language regularly. It is cryptic for those who have not used them. The English-based keywords are somewhat less cryptic only for English speakers, and even for them they can be misleading before they learn their correct meanings.
- misja111 10mo ago> The virtues of APL that strike the programmer most sharply are its terseness — complicated acts can be described briefly, its flexibility — there are a large number of ways to state even moderately complicated tasks (the language provides choices that match divergent views of algorithm construction), and its composability I had an introduction to APL in university and what I absolutely hated was this terseness. I guess when you're a mathematician APL is more natural but to me, as a programmer, I much prefer to have some extra verbosity to make my code more (human-)readable.
- adrian_b 10mo agoTerseness is easier to remove from a programming language than verbosity. You can use a source preprocessor to enable you to write APL programs by using keywords instead of any symbols that you do not like. You can also use a source preprocessor to expand any traditional APL source, by converting symbols into keywords, so that it will be easier to read for you. Using symbols instead of keywords is a minor feature of APL, which was inherited from the standard mathematical notation, from which APL was derived. The important features of APL are the expression syntax and the set of available operators, not the symbols used for them. Moreover, if you have difficulties in following complicated expressions, you can always break them in smaller subexpressions. When someone presents an "incomprehensible" APL program, they show a huge expresion without comments. A decent APL program, like in any other programming language, would need good comments, but here comments are frequently desirable at the level of subexpressions.
- misja111 10mo ago> A decent APL program, like in any other programming language, would need good comments, but here comments are frequently desirable at the level of subexpressions. I guess that might be true for APL, for other programming languages that's not true at all. The ideal program is clear enough to be self explanatory. Of course there might be some implementation choices that need a comment. Or in some cases the problem is so difficult that this is not possible. But readability should be the goal and most of the time this is feasible without comments. E.g. by using descriptive variable and function names. And by breaking up your program into logical and cohesive parts, using functions, objects, modules or whatever construct your language is offering.
- jaksdfkskf 10mo ago[dead]
- runeks 10mo agoI find APL very difficult to read. Incidentally, I am told (by stack overflow) that the APL expression "A B C" can have at least four different meanings depending on context[1]. I suspect there's a connection here. [1] https://stackoverflow.com/a/75694187 https://stackoverflow.com/a/75694187
- skruger 10mo agoYes, it's either an array (if A, B and C are arrays), a function derived via the dyadic operator B, with operands A and C being either arrays or functions, a dyadic function call of the dyadic function B (A and C are arrays), or the sequential monadic application of functions A and B to array C, or a derived function as the tacit fork (A, B and C are functions). Did I miss anything?
- abrudz 10mo agoYes, it can also a fork where A is an array while B and C are function and a tacit atop where either B is a monadic operator and A its array or function operand or A is a function and C is a monadic operator with B being its array or function operand. Finally, it can be a single derived function where B and C are monadic operators while A is B's array or function operand.
- boxed 10mo agoDo APL programmers think this is a good thing? It sounds a lot like how I feel about currying in language that have it (meaning it's terrible because code can't be reasoned about locally, only with a ton of surrounding context, the entire program in the worst case)
- creata 10mo agoHuh? Currying doesn't require any nonlocal reasoning. It's just the convention of preferring functions of type a -> (b -> c) to functions of type (a, b) -> c. (Most programming languages use the latter.)
- JaumeGreen 10mo agoOne of my list of dream projects that I might never have time to do, and so feel free to "steal" the idea, would be a eink notepad in where you could code in APL or similar. APL was born as a mathematical notation, pertaining to the blackboard, so it makes sense to write it using a writing implement. Its terseness would make it ideal for the handwriting world, it's REPL implementation would give quick feedback loops, you could move around input and output streams. You could be in a sofa, writing the solution, expending most of your energy thinking, not writing, once you got used to the new way of thinking and the vocabulary. If you haven't tested any array language I would recommend you try to solve things using one, and check existing solutions so you can see how to think differently. Some problems are naturally easier with this approach, some are harder.
- icen 10mo agoYou might be interested in this then: https://mlajtos.mu/posts/new-kind-of-paper https://mlajtos.mu/posts/new-kind-of-paper I’ve not used it myself, but it appears to be the thing you’re wanting?
- kkylin 10mo agoI've had the same dream! thanks for the pointer.
- bunderbunder 10mo agoI would probably just go for an Android eink tablet like the ones made by Bigme and Onyx Boox. It looks like there are a few APL implementations for Android out there, or you could use a remote editor or terminal app to access an APL implementation running elsewhere.
- mlajtos 10mo agoYou are exactly right that the original vision of APL was a handwritten, non-ambiguous, consistent, and executable math notation. This was never accomplished. In 2021, I made a prototype calculator designed for iPad and Pencil and wrote four essays called "New Kind of Paper" describing this concept. The video demonstration of the prototype [Demo] sums up pretty well how it might be used. In 2024, Apple released Math Notes, which implements this concept for standard math notation. My "review" of it is at [MathNotes]. In short, it is currently a preview of a damn great tool, but its future depends on notation and expressivity. APL is a language from 2066, created in 1966. While its semantics make more sense now due to machine learning, syntactically it remains alien to most people. Backus' FP/FL and Iverson's J are more approachable to current programmers, but still not there. In New Kind of Paper, I created a tiny language called Fluent, which is nowhere near the ambition of any language mentioned, but it is intentionally designed to be handwritten. A week ago, I open-sourced it. [Fluent] There is plenty of work left to do, but it is a good start. [NKoP]: https://mlajtos.mu/posts/new-kind-of-paper https://mlajtos.mu/posts/new-kind-of-paper [MathNotes]: https://mlajtos.mu/posts/new-kind-of-paper-5 https://mlajtos.mu/posts/new-kind-of-paper-5 [Fluent]: https://news.ycombinator.com/item?id=46649223 https://news.ycombinator.com/item?id=46649223 [Demo]: https://youtu.be/y5Tpp_y2TBk https://youtu.be/y5Tpp_y2TBk Thanks for coming to my TED talk.
- baruchel 10mo agoI’ve practiced array languages extensively myself, including for code golfing, and I fully understand the intellectual joy they can provide. But as I’ve gotten older, I’ve come to see a deep mismatch between what these languages present as “elegant” and what I find truly elegant from a computer science perspective. Sure, realizing that the foobar of x is nothing more than the transpose of the 15th foo of x, combined via an inner product with the 7th bar of x raised to the power of baz, can be an ineffable intellectual delight. But actually computing that, rather than writing a “boring” loop, feels horrible to me. To my eyes, a “boring” piece of code written by Dijkstra in some Algol-like language contains more beauty than all these dazzling sleights of hand that hide zillions of loops under the rug while pretending that the actual computation doesn’t matter.
- bunderbunder 10mo agoOn the other hand, whenever I see Python code that does calculations over arrays of data with nested loops instead of using numpy, it always takes me a distressing amount of time to see what the code is actually doing and that the bug is because of a typo buried deep in that 100 lines of code that caused one of the inner products to be incorrect.
- veqq 10mo agoArray languages are more conceptually simple. What do you concretely mean to mock with: > realizing that the foobar of x is nothing more than the transpose of the 15th foo of x, combined via an inner product with the 7th bar of x raised to the power of baz
- t-3 10mo agoIt's not like array languages don't do any optimizations... Denying the programmer the ability to be clever by manually writing loops makes some things easier and simpler for the compiler as well.
- meken 10mo agoI enjoyed the FBAPP acroymn. There should be a modern day equivalent.
- kstrauser 10mo agoI’d like to play with an array language because I’ve never used one. I don’t want to pay for it; this is just for fun and as an experiment. I also want to run it locally in a shell, writing it in a local editor, not working in a web UI. And while popularity isn’t everything, and none of these are exactly Python levels of widespread, I also don’t want to find myself learning a cool one along with 3 other people in the world and then find out all other array language programmers do things completely differently. (Analogy: I don’t want the equivalent experience of picking Haskell as my first ever PL.) This topic tends to bring up a few, like APL itself, J, K, and BQN. Given those (soft!) constraints, what’s the one I want to start hacking around with?
- vegabook 10mo agothere's also a Forth-meets-APL project called uiua [https://www.uiua.org/ https://www.uiua.org/]
- kstrauser 10mo agoThat may require a little more mental bandwidth than I can summon right now. It looks incredibly cool, though.
- invalidOrTaken 10mo agoI haven't tried the others, but J meets all those requirements.
- RodgerTheGreat 10mo agoYep. J has a small userbase, but it isn't fragmented into dialects like K or even APL, J uses ASCII characters instead of requiring a custom font/keyboard layout, J is FOSS, J has extensive learning materials, and J is reasonably batteries-included and suitable for making practical nontrivial programs. I like K better than J aesthetically, but it's harder to recommend to beginners due to the fragmentation of the ecosystem.
- kstrauser 10mo ago
- i-blis 10mo agoJ is, within the APL family of languages, the one I have always found the most useful. I reach for it as I used to reach for my HP calculator in the past, to quickly compute or numerically model things. I always have it running in a terminal window. Contrary to popular belief, its learning curve isn't steep. I once introduced it to high school freshmen who had no real experience with programming. I recommend the series of booklets by Kenneth Iverson himself: Arithmetic, Algebra, Calculus — there is even a Concrete Mathematics companion to accompany the book of the same name by Graham, Knuth et alii. They're all available for download on the site.