18 ms·
Notation as a Tool of Thought (1979)
- zetalyrae 4y agoAmong all languages, APL has the highest ratio of times its founding document is posted to Hacker News to lines of code written. I don't mean this to be terribly dismissive: I've always been "tangentially fascinated", like I think a lot of people are, by APL and Forth. But I've never properly used it because ultimately it's in conflict with how I think programs should be written: with types, abstraction, a focus on readability etc.
- mlochbaum 4y agoTo be fair, "lines of code written" is a particularly poor choice of denominator when discussing APL. But I think you're also unaware of historical usage. There are some very large (I believe close to a million lines) financial applications still in use, and far more applications for ordinary tasks like scheduling, payroll, and other administration made for companies and universities in the 80s. Now that the ACM has made them free to access, papers from the APL conference are a good place to look to get a sense for this; APL79 was the first really huge one: https://aplwiki.com/wiki/APL_conference#1979 https://aplwiki.com/wiki/APL_conference#1979
- zetalyrae 4y agoI'm aware of kdb+. It has an SQL interface and clients in multiple languages. How many of their users use the APL interface? And how many financial companies are planning on building new products on top of a technological dead-end from the 1960's? There was a time when APL was taught in universities, and some computers came with APL-specialized keyboards. That time came and went because the bulk of mainstream software development went in a wildly different direction.
- andylynch 4y agoPlenty. The sql-like interface (in Q) is mostly syntactic sugar; the functional style takes you much further. That said KX is making a huge push on ease of use and front end where you don’t necessarily need to use Q.
- mlochbaum 4y agoFor clarity, I'm talking mainly about SimCorp[0], which is a user of Dyalog APL, not kdb. The core of Dimension uses APL (with many other parts in C#), and there's a separate APL product bought with APL Italiana as well. They employ hundreds of APL programmers, preferring to hire math and physics majors out of college because they're easier to teach. Yes, SimCorp probably wouldn't start with APL today, and I wouldn't give it a second thought either if I were trying to start a big business. I pointed to the large codebases because they're easier to quantify, but I'm sure there are millions of lines written by hobbyist developers. I know you're not trying to flame, but what you've given us so far is a false claim that nobody writes code in APL, and a bare assertion that APL is a bad way to program. On that note, you're trying to say a language you've never used doesn't allow for "abstraction" or "a focus on readability", which I think is dead wrong. All of which is at best tangentially relevant to Iverson's claim in the paper (not APL's founding document, by the way; that would be A Programming Language) that APL's notation is a way to enhance your thinking. APL has good and bad aspects, and there's a lot to discuss, but can it please be a discussion instead of these careless remarks? [0] https://en.wikipedia.org/wiki/SimCorp https://en.wikipedia.org/wiki/SimCorp
- blululu 4y agoFWIW APL is pretty influential to Matlab which is the inspiration for Numpy, etc. I think the trouble is that the authors are right about the importance of notation but they were also making the first pass and they made some choices that proved to be off in practice.
- skruger 4y agoIf you're familiar with both modern APL and the "Iverson ghost" NumPy, you'll likely find the latter a frustratingly crippled experience.
- blululu 4y agoFair. I don’t think anyone transitions from Matlab or Julia to Numpy and feels good about it, but the broader ecosystem advantages are decisive there.
- buescher 4y agoI suspect a lot of the casual fascination with APL these days comes from frustration with Numpy. In the same way that nobody had anything good to say about Ada until C++ and Java were firmly entrenched.
- skruger 4y agoI am an APL-fan specifically because it's like a parallel universe where evolution took a different path: what are often considered anti-patterns in main stream languages is best practice in APL. It's a welcome relief from the strait-jacket of "the Zen of Python". No libraries? It's a feature. Single-letter variable names? Of course. Terseness as a virtue? Oh yes. Right-to-left flow? Why not? Precedence levels? Who needs them? Tacit? Bring it on. APL is easily the most productive tool in my chest.
- nequo 4y agoWhat kinds of tasks have you used APL for?
- thrown_22 4y agoIt would be trivial to have a typed forth, the reason why no one bothers is because at the micro controller level all data is the same datatype: bits. What helped me understand and become productive in forth was that you had the normal commands which manipulated values and are in every language, and a meta-language for manipulating the stacks. Once I made the stacks dance forth became just another language.
- octref 4y agoIf you enjoy this, you might find this meta list on "notation and thought" interesting: https://github.com/k-qy/notation https://github.com/k-qy/notation
- zetalyrae 4y agoI found this by Knuth on Iverson's notation interesting: https://www.maa.org/sites/default/files/images/images/upload_library/22/Ford/knuth403-422.pdf https://www.maa.org/sites/default/files/images/images/upload...
- practal 4y agoVery interesting. I did never really look at the "Concrete Mathematics" book, so I missed this take by Knuth on turning a formula F into a term [F] by defining it as 1 if F is true, and 0 if F is false. Note that this cannot be done in first-order logic, as a formula cannot be part of a term. But it is not a problem in simply-typed higher-order logic, for example, and it is not a problem in abstraction logic, either.
- deleted 4y ago[deleted]
- samh748 4y agoThank you so much for this!! The bit on "avoid ambiguity, or introduce useful ambiguity" is especially fascinating.
- deleted 4y ago[deleted]
- Koshkin 4y agoCompactness of notation is important, and verbosity of code (which I think became widespread since the advent of Java) only serves to hurt understanding. Given the right context, mathematical notation is easy to understand (and it often “computes itself”). Mathematical texts use the “literate” style which unfortunately has not found its adoption in software industry, even despite the fact that prof. D. Knuth has been advocating it since the 1960s…
- throwk8s 4y agoI find that terseness has a real downside when debugging code. If you need to get down to the level of what is actually executing, having to unpack all that compact code involves many more things than I can keep in my short-term memory. Compactness is great for things that are true and work, but when there's a bug in there somewhere, terse code requires a lot of scribbling on paper.
- occamrazor 4y agoMathematicians use very terse notation in formulas, but accompanied by a lot of natural language text. The equivalent in programming would be terse code with long comments and documentation. Many programmers instead see self-documenting code as the ideal outcome: maybe not very compact, but virtually free of comments (and with documentation at least partially autogenerated). In reality, successful open-source projects tend to have many comments in the source code. Often not one-liners, but detailed descriptions of functions, their arguments and algorithms, motivation for the choice of the implementation and so on.
- Banana699 4y agoThis a case for more powerful debuggers that can unroll code for you.
- rramadass 4y agoI used to believe this but i don't anymore. From https://github.com/tlack/b-decoded https://github.com/tlack/b-decoded Arthur is famous for his very dense programming style. Most C programmers would scream when seeing this code. In his view (and others in the terse scene), it is much better to have everything in your application readable on the screen at once than to have great names for things or a lot of white space to comfort the first timer reader. To them, once you've sufficiently studied that screen or two of code, you can understand all of it at the same time. If it's spread out over thousands of files, it's very difficult to understand all of it, which leads to bugs, unnecessary abstraction, and the need for advanced tooling just to work with your own project's code. He wants to see the code "all at once" so he can understand all of its behavior without paging around and shifting his focus to another tab, window, etc. To get there he makes a lot of tradeoffs in terms of the code formatting and naming conventions. He also, in b, creates a dense set of interlocking macros and abstractions that can make the code very hard to follow. Critics and the uninitiated say that his code is like old school modem line noise: random punctuation intermixed with bits of understandable code. I would suggest that he's actually quite careful with the abstractions he chooses and they are actually not always the most dense, highly compressed code structures available to him. He chooses wisely and his code rewards deep study. Interview with Arthur Whitney: https://queue.acm.org/detail.cfm?id=1531242 https://queue.acm.org/detail.cfm?id=1531242
- melling 4y agoYesterday, I posted this 1974 interview with Iverson and the group who developed APL. https://news.ycombinator.com/item?id=32173840 https://news.ycombinator.com/item?id=32173840 I started down the APL/J path last week after watching this APL study group with Jeremy Howard of fast.ai: https://youtu.be/CGpR2ILao5M https://youtu.be/CGpR2ILao5M https://forums.fast.ai/t/apl-array-programming/97188 https://forums.fast.ai/t/apl-array-programming/97188
- bfors 4y agoDoes anyone else have a long list of dense material like this that you have an intention of going through someday? Do you ever end up actually doing it?
- shakezula 4y agoFunny you mention that, cause I just added this article to a longer-ish list of long-form posts I want to read in depth. I don't make my way to that list as often as I'd like, but I have found plane trips and other similar times are great for when I want to do something like that. Sitting down with a longer blog post and taking notes on a 5 hour flight is oddly relaxing. So yes, to answer your question, I do get around to it eventually when the post is worthwhile.
- stinkytaco 4y agoSo long. Bookmarks, pocket articles, org-roam notes, things jotted in notebooks, I even have an org capture template that quickly populates a list of "recommended media" (books, movies, etc) from friends and relations. Maintaining my list of things to read or watch has become a hobby unto itself. Every once and a while I go through some[1] of it and ask myself "Will I ever actually look at this"? Sometimes there's a clear answer, but more often it stays in the list because it still looks interesting and I only consume maybe 5-10% of what I saved. There's got to be some term for this. Digital hording? It makes me anxious to have it and anxious to just delete it. There are plenty of times I do remember something I saw and wish I could find it again, but I lean too hard into "maybe I'll think about this again and want it". [1]: It's so long I generally lose the will to even evaluate the items after a while.
- deleted 4y ago[deleted]
- patcon 4y agoI keep such a list in Roam, and usually neglect to pluck things from it. But it's more that when I go to add something and it's already there or has some relation to something already there (e.g. same author), I'll often give it more attention immediately. It's not the best system, but I suspect it's better than never writing it down :) (This perhaps a bit of an ADHD-specific tactic)
- kubanczyk 4y agoEh? This line of the appendix: > Boolean: ∨ ⍱ ~ (and, or, not-and, not-or, not) In some places in the pdf the notation looks sketchy. But this line demonstrates beyond any doubt that the pdf is missing chars.
- civilized 4y agoI love the idea that notation matters for thought. I remain unconvinced that APL is a particularly good one, but I have definitely adopted "tool of thought" as a core productivity concept. For example, a plain text file, Google doc, or Trello board are all decent tools of thought, while JIRA isn't.
- trenchgun 4y agoPerceptual & cognitive ergonomics
- pklausler 4y agoI loved APL for decades but realized a while back that thing I appreciated most about the language wasn't how it deals with arrays but rather how well it supported the easy composition of functions -- and that primed me well for languages that do that sort of thing even better. And yet I miss many things about APL when coding in modern functional languages. Specifically, having the shapes of arrays being a concept that's distinct from both their types and from their values is something that I can't reproduce in Haskell.
- auggierose 4y agoCan you elaborate a bit more what you can do with shapes that's not easily replicated in other languages?
- kjellsbells 4y agoDoes the notion of suggestability extend to the notion of "creative breakage"? The latter is an important feature of a mathematical notation. For example the dy/dx notation in calculus naturally leads to inquisitive thinking. Can you multiply by dx? It looks like a division but it isnt, really, except that a soon as you get past Calc 101 you are spraying dys and dxs all over. the notation is just incredibly suggestive. Another example is exponents where m^n is introduced naively for natural n but instantly prompts the question around non integer n. i think that having a notation that is suggestive and can be creatively broken to use in new ways is v important
- mlochbaum 4y agoIverson usually expresses the derivative as an operator, which ties into Heaviside's operational calculus[0] but doesn't have multiplication rules like dx/dy (I'd probably be more on your side here, in favor of dx and dy). I don't think he was too comfortable with mathematical concepts that don't resolve into specific calculations. Which may be why his notation ended up being so easy to turn into a programming language. To me, Iverson's suggestivity would be more about unifying or making analogies between established concepts. For example, APL uses * for exponentiation and ⍣ for repeated function application. [0] https://en.wikipedia.org/wiki/Operational_calculus https://en.wikipedia.org/wiki/Operational_calculus
- Koshkin 4y ago> Can you multiply by dx? Maybe. But can you multiply by ∂x?
- Blammar 4y ago"dx" is a term rigorously defined in infinitesimal calculus (IMO a much easier to understand approach to differentiation.) So, yes, you can multiply by dx (even if x is a more complicated function.) ∂x would have a problematic definition, as it would require selecting from its components based on information not supplied. E.g., let x = y+z. Then dx = dy + dz. But ∂x (by extension) = ∂y + ∂z, but at least one of these terms on the right is identically zero, depending on whether y or z is held constant. So ∂x doesn't have a meaning.
- anonu 4y agoSo obviously this gave birth to the hugely popular kdb. And now shakti is around the corner.
- deleted 4y ago[deleted]
- shrubble 4y agoThere is GNU APL which is a decent 100% free APL, for anyone who wants to try it out. The Emacs mode for it allows you to pop up a keyboard with the symbols; as well, there is a "." mode, where for instance .i becomes the iota operator.
- credit_guy 4y agoUnderwhelming article. The title is so powerful though, that this article makes the front page of HN quite often. The thing is, notation is always a tool of thought. No exceptions. Take two matrices A and B. The notation AB for the matrix product is a great thinking tool. The matrix product is so strange when first seen, but the fact that it is introduced as a product, with the same notation as the product notation for scalars, makes it so much easier to grok. Imagine that we'd had used A@B, like in Python (numpy).