5 ms·
I think that the vast majority of people who complain that these languages are unreadable and who insinuate that people who use and like them are basically just
by why218 1y ago
I think that the vast majority of people who complain that these languages are unreadable and who insinuate that people who use and like them are basically just showing off are fundamentally uninterested in the possibility that there are possible positive trade offs to this style but for those who are genuinely interested in why some people like to program this way: Imagine having to do math with no symbols. that means 1+1 is now one plus one. Now imagine having to do that in the context of graduate levels mathematics. I am quite sure nobody calls a2+b2=c2 unreadable as compared to a squared plus b squared equals c squared and I dont know any one who wants to do algebra that way. Well the same principle is why array programmers like this style. I dont expect you to take my word for it im just letting you know what these other weird crazy people see in array languages that you dont. This allows one to think faster and further than they could encumbered but a heavier syntax. Is this way of programming the best no. Should everyone learn it no. Are there trade offs yes. Is it worth your time, quite possibly not. But thats true about literally everything in programming.
- andoando 1y agoI just fail to see the point. I could see the use for some convenient functions for array manipulation, but why not just implement these as a library in any existing language? >This allows one to think faster and further than they could encumbered but a heavier syntax. How does the programming language limit your ability or speed of thinking, lest when the fundamental data types and operations are the same? The hard work is always knowing what to implement. Saving some keystrokes for reversing an array or whatever other array manipulation is hardly a game changer.
- sundarurfriend 1y ago> library in any existing language An example of this is APL.jl [1][2] It seems more of a proof-of-concept than a real implementation though - at least, the APL wiki calls it a "toy dialect of APL" and says that it "works on a minor subset of APL". [3] [1] demo: https://nbviewer.org/gist/shashi/9ad9de91d1aa12f006c4 https://nbviewer.org/gist/shashi/9ad9de91d1aa12f006c4 [2] repo: https://github.com/shashi/APL.jl https://github.com/shashi/APL.jl [3] https://aplwiki.com/wiki/APL.jl https://aplwiki.com/wiki/APL.jl
- andoando 1y agoThis looks more like an interpreter. What I mean is just take the symbols in Klong and write them as methods on arrays. Sure the syntax won't be the same, but does that really warrant a whole new language?
- t-3 1y agoWhy not a whole language when so many problems can be easily reduced to these few methods? It's worth noting that almost all array languages are interpreted, and iteratively constructing a program in the interpreter is common. This style would be painful in a more verbose and lower-level language but works great for ultra-high-level array languages.
- nine_k 1y ago> why not just implement these as a library in any existing language? I bet you heard about NumPy :) (Also Pandas, Polars, etc.)
- why218 1y agoI think there is literally nothing I could say that would change your mind. You've already decided what you think. There are a number of benefits but none that I could write out and have you someone who is uninterested immediately take my word for it and go home a fan. But I'll try to answer your (probably rhetorical) direct question. "How does the programming language limit your ability or speed of thinking". Again tell me how it is you do difficult math? Do you write out english or do you work with notation that makes it easier to feel and calculate your way through a problem. if you wanted to write a program in a new domain do you honestly think you would come to the same level of understanding of the topic at the same speed if you use assembly vs python. Yes the hard work is knowing what to implement; arrays languages help its users know what to implement. Ultimately, these are all just claims I can't prove to you what experiences you will or wont have if you learn the languages. You wont just believe and you shouldn't just believe me. If you are interested, learn more and try it out! (theres the apl and k wikis, a discord called the aplfarm a podcast called the arraycast etc.) If not just write array languages off and move on.
- andoando 1y agoMost programmers don't do any math at all, so maybe this is just a niche thats not relevant to most of us, but to answer your question: If I am thinking about any problem, its outside the scope of any programming language in the first place. My point is, modern functions already make array manipulations simple enough. Even if you're doing something like coding LLMs from scratch, numpy, list concatenations, list comprehension, lambdas, stream/map/reduce all exist and its not nearly an issue to implement them, as is the case for writing assembly vs python. The prime example in python for example looks like this: all(x % i != 0 for i in range(2, x)) This pretty much does the same operations in the same order on the same fundamental data structure, so I just don't see what's fundmenetally different about the Klong way of thinking. Anyway, I don't mean to argue, if it works for you great, I wish I had something new
- why218 1y agoMy point with math is not that this only applies to fundamentally math like things but that these languages do for programming what the math notation does for math problems for me. "if i am thinking about any problem, its outside the scope of any programming language in the first place" yes I felt this way too before I learned an array language. Sorry that was a rude way to put that but I do genuinely mean that. Array languages help me solve problems I wouldn't know how to solve otherwise. that python code looks suspiciously full of symbols and one character variable names :). Maybe it would be easier like this: all(exes modulo index not equal zero for index in range(two, ex)).
- t-3 1y agoIt's not about saving keystrokes, it's saving brainpower and effort when reading, writing, and modifying code. Instead of thinking about control flow and nested loops when doing multiple complex operations on an array, you're thinking only about the array operations. Abstracting away the loops and control flow frees the programmer from the most tedious and error-prone parts of programming.
- sundarurfriend 1y ago> Imagine having to do math with no symbols. that means 1+1 is now one plus one. Now imagine having to do that in the context of graduate levels mathematics. That's a good way to put it. It's pretty hard to convey this to someone who hasn't actively tried and solved real problems in such languages though. You don't realize how much the "words get in the way" (as Granny Weatherwax would say) until you give an array language a good chance. Another pop-culture quote that resonated in this regard is from The Matrix: > Your brain does the translating. I don't even see the code. All I see is blonde, brunette, redhead. All I see is range, sum-over, divide. The symbols turn into the concepts directly in your head - not as conscious translation, but in the way I imagine Chinese or Japanese kanji characters translate directly in the head of a native speaker.
- why218 1y agoYes as someone who was exposed to kanji as a child I can say that at least for me the experience is nearly identical
- jasonwatkinspdx 1y agoIverson's Notation as a Tool for Thought is an argument in favor of the above. I don't think it's flatly wrong, but I am skeptical of the more strong forms of it. I think it's important to remember that APL was born of an era where having a keyboard dedicated to a single programming language was reasonable. I think there's a lot of middle ground between the more line noise syntax of say jsoftware, or a pure lisp style prefix notation. This is a little snippet from Stevan Apter, a k programmer that has an old school home page with a lot of array language curiosities: https://nsl.com/papers/kisntlisp.htm https://nsl.com/papers/kisntlisp.htm If you look at the pseudo code example at the end using words vs ascii glyphs, I think that's quite readable while also concise. It uses k's bracket notation to easily specify slices of nested arrays. Interestingly kxsoftware themselves went this route with q (Stevan's essay predates this I believe). There they kept nearly all the power of k but exposed it va a more approachable sql like syntax.
- nkrisc 1y agoI thought it was another one of those cryptic, inscrutable languages, but following along the explanation of the prime function reveals it’s not actually as complex as it looks, and is a quite straightforward right to left application of operators. Not nearly as bad as I first thought.
- MontyCarloHall 1y agoI understand the appeal of array languages — they provide very convenient shortcuts to common loop constructs in traditional imperative scalar languages. Their usefulness is manifest in the popularity of NumPy (and its derivatives, e.g. TensorFlow, PyTorch, JAX, etc.), MATLAB, Julia, R, and other Iverson Ghosts [0]. The rise of map/reduce/filter operations in common scalar programming languages is also testament to array languages' usefulness. I understand (though do not personally agree with) the appeal of extreme terseness — there are arguments to be made that maximizing information density minimizes context switching, since it reduces the amount of scrolling. Personally, I find that large displays and split buffers mitigate this issue, whereas the mental overhead of using my short-term memory to map dozens of single letter variables to semantic definitions is much higher than having to flip between splits/marks in my text editor. (The fact that the aforementioned Iverson Ghost languages are popular whereas APL and its derivatives are not is evidence that I'm aligned with most people in this regard.) I don't understand why people rarely make the terseness argument for non-array languages, even though it's just as easy to write tersely in them — the Obfuscated C Competition is a prime example [1]. Is it just due to the influence of APL, or is there something special about array languages that gives them a unique proclivity for terseness? [0] https://dev.to/bakerjd99/numpy-another-iverson-ghost-9mc https://dev.to/bakerjd99/numpy-another-iverson-ghost-9mc [1] https://www.ioccc.org https://www.ioccc.org, https://github.com/ioccc-src/winner/blob/master/2020/ferguson2/prog.c https://github.com/ioccc-src/winner/blob/master/2020/ferguso...
- hoosieree 1y agoArray languages don't just have shorter tokens, they have fewer of them. A small token set is practical because your language's users can only keep a finite number of things in their working memory. This constraint leads to symbol overloading. But careless, rampant overloading results in the same problem - too many things to remember. So you have to constrain your overloads. With these constraints, if you want to design a practical, usable, general-purpose language (without forcing users to define every useful thing themselves), you have to choose composable abstractions. Prioritizing a single data structure (arrays) lets you focus your design effort and historically has good mechanical sympathy with the available computers, but there could just as easily be an "APL, but for associative maps" type language. My point is "good terseness" comes from a holistic design approach, and simply making a bad language more terse will makes its flaws more obvious.
- nine_k 1y agoMathematical notation actually pays quite a bit of attention to readability, to visual separation of things to make the whole easier to parse. Multi-story fractions, subscripts and superscripts, oversized or miniature symbols, parens, etc, etc. This is why math in a textbook very often looks much more readable than the same math in typical Python or Fortran code. I wish APL derivatives embraced some of these ideas, and made their magic spells easier to parse visually, and to format for readability. I don't know how to achieve that easily. Mathematical notation took centuries to develop. It took quarter of a century for programming languages to normalize indentation. Maybe APLesque languages will eventually come up with a notation that's less impenetrable than APL / K / Q, but less verbose than Pandas.
- why218 1y agoWell some of what you mentioned has been implemented in array languages and some like superscript and sub script was part of the original apl book (the book on the notation pre the implentation). Its somewhat ironic, orignally apl was supposed to make math notation more readable (it was originally just a math notation) but many people dont see it that way. if you are interested in super scripts and the like you might check out bqn and uiua which both are doing interesting things with the symbols. although uiua in particular suffers from having to choose from a set of symbols that comes from unicode and therefore sometimes look a little off to me
- HexDecOctBin 1y agoIs this the book? https://www.softwarepreservation.org/projects/apl/Books/APROGRAMMING%20LANGUAGE https://www.softwarepreservation.org/projects/apl/Books/APRO...
- marssaxman 1y ago> Imagine having to do math with no symbols. I would probably prefer this, because then I could actually look up the unfamiliar terms and have some hope of eventually figuring out what the equation meant, instead of being brought up short and stumped by inscrutable notation.
- why218 1y agoeven for actual calculations? if so then touche. But (and I may be wrong) I feel like this comment is coming from a place of I need to look up some formula which for some other task. Like say im making a video game and I want some geometry formula. In such a case what you care about is not how easy a notation is to use but simply getting info as fast as possible in which case learning new symbols just gets in the way rather than actually writing correcting algebraically manipulating and extending (keep in mind im using math as an analogy for programming in not actually speaking about array languages being used _for_ math necessarily). This is a fair criticism of array langauges you do need to learn something which is quite different from the usual english based languages and they are not great for black boxing i.e you have to know the domain of your problem because relying on libraries is impossible at worst and not any better than python or java at best. That being said I find them more scrutable than most langauges partly because of the tersity. And partly because of the limited vocabulary. You can look up unfamiliar operators very easily in array languages because they all come with multiple (some more for reference some more for learning) easy to go to places to do so. But more importantly there really are only so many so you can learn them all (in the same way you already learned your numbers + - 3 %, and so on) once you do you dont feel the need to look up 6 or & or + mean you just know them. In contrast in a language like python or javascript im constantly looking up how things work because there are just infinitely more things the source code of which is often hard to get to and when you find it it is very long (and therefore (for me) hard to read). When I see an array function I actually can scrutinize them when I see a python function I need to hope that its simple and named in a way that makes automatic sense to me or give up and look it up somewhere else (in docs say).
- marssaxman 1y agoThat's fair. My remark was a bit of a tangent, borne of frustration over years of trying to read papers relevant to my interests where the juicy bits are all written in math notation and therefore inaccessible. I have to go track down some open-source implementation of the idea and read that to understand what the paper is trying to say - any programming language at all, even one I've never seen before, will be easier to understand than the original symboldegook. I can imagine that it's a much different situation with array languages, where the notation is actually learnable, because it is defined and documented.
- spit2wind 1y ago> Imagine having to do math with no symbols. that means 1+1 is now one plus one I think that's exactly on point. Here are two examples from Euclid which demonstrate why mathematics, and likely science, were stunted for millenia: "if a first magnitude and a third are equal multiples of a second and a fourth, and a fifth and a sixth are equal multiples of the second and fourth, then the first magnitude and fifth, being added together, and the third and sixth, being added together, will also be equal multiples of the second and the fourth, respectively." a(x + y) = ax + by "If a quantity increased by three becomes five, then that quantity has to be two". X + 3 = 5 X = 2