2 ms·
This always comes up in discussions about APL, J, and K. Have you ever tried reading Euclid's "The Elements"? It's all prose and appreciably less clear than th
by xelxebar 2y ago
This always comes up in discussions about APL, J, and K.
Have you ever tried reading Euclid's "The Elements"? It's all prose and appreciably less clear than the modern algebraic formulations. Of course, that's only because we're all already familiar with the algebra, but once you know both notations, the terse symbolic one is an obvious win on readability and clarity.
And it's just not that hard to learn some tens of symbols. In practice, languages like Rust and whatnot require you to learn orders of magnitude more words, which require you to learn new mental models to understand what the mnemonic names mean anyway. The "readability" is really just smoke and mirrors, IMHO.
Once you know APL or K, then clusters of "unreadable" symbols become immediately recognizable and, frankly, stupidly straightforward. And to top it off, instead of some opaque identifier, the "name" in APL is usually the entire implementation! That empowers you to make variations as needed, reason about performance, and observe meta-patterns between names. Those are higher-level cognitive tasks that the symbols make much more legible than is possible with "readable names" everywhere.
In our software development industry, the word "readability" is mostly just code for "familiarity to me".
- andoando 2y agoI agree with you for the most part. Brainfuck certainly would be way more readable if you gave a collection of symbols names and used those instead. But thats mostly because base level constructs of brainfuck are too low level. Nonetheless pragmatically, what we're already familiar with is part of the equation. If you wrote a language where + actually meant - then surely youd consider this to be harmful to the adoption of the language. Theres also the fact that the time it takes to learn these symbols is multiplied by ever person learning it, so if youre going to introduce new constructs/symbols/mental mappings, it has to be worth the tradeoff. If the tradeoff is just less characters to type imo its not worth it. If one language has say "sort(x,y,z)" and another says "!" means sort, I just dont think that's particularly interesting
- RodgerTheGreat 2y agomany of K's symbols are, in fact, familiar. the dyads + - * & | < > = have meanings that should be immediately obvious to most programmers, even if they don't initially appreciate how general the K versions of these primitives are. some symbols have simple mnemonic associations to operations that are common; the monad # is "count", the dyad @ is "at-index", the dyad ? is "find". primitives have enlightening symmetries that simplify memorization. the adverb / ("over") has a twin that captures a trace of intermediate steps, \ ("scan"). all valences of "over" have corresponding scans. overall the set of primitive operations is very carefully chosen such that simple combinations fit together in many useful ways. more than simply saving keystrokes- which has benefits for interactively exploring data and algorithms- k provides an efficient way of thinking about and communicating a large range of algorithmic ideas to other k programmers.
- andoando 2y agoThat makes a lot of sense. I was being overly skeptical, Ill have to spend time on learning it before criticizing it.