6 ms·
There are a lot of comments of the type "it's unreadable/write-only/unmaintainable" here. It's a natural reaction; I know, I was there. It looks different. But
by skruger 4y ago
There are a lot of comments of the type "it's unreadable/write-only/unmaintainable" here. It's a natural reaction; I know, I was there. It looks different. But readability is in the eyes of the beholder, not the language. I made this point in my APL book (https://xpqz.github.io/learnapl https://xpqz.github.io/learnapl) -- just because I can't read Japanese does not make Japanese unreadable. Since I wrote that book, I've spent a few years immersing myself in APL, gradually rewriting thousands of lines of Python into APL, and it's such a productivity boost. My code is an order of magnitude smaller. More, sometimes. Fast, too.
For the right use cases, it's unbeatable. Sure, you probably wouldn't want to write an OS kernel in it, but anything that reads a bunch of data, mashes it up, and spits out some result, APL is a hand-in-glove fit. And with modern SIMD processors, APL really screams.
https://xpqz.github.io/learnapl https://xpqz.github.io/learnapl
https://xpqz.github.io/cultivations https://xpqz.github.io/cultivations
Drop in on https://apl.chat https://apl.chat if you're interested.
- ohbtvz 4y ago"Fast" is not relevant - the runtime would be just as fast if the code was written in plain words. Code size is also irrelevant unless you're called Elon Musk. The only claim left is that it's a productivity boost, but I just can't see how a language that needs a special keyboard to be written can be written more productively than actual words, especially with modern IDEs.
- abrudz 4y agoI type each APL symbol with a single chord, e.g. ∊ is AltGr+e and ⍷ is AltGr+Shift+E. Each keystroke is basically instant.
- MichaelCollins 4y agoYou don't worry about repetitive strain injury from all that chording? I try to avoid that sort of thing as much as possible; even though I use emacs, I do it with evil bindings. Capslock rebound as control is useful, but the bottom row modifiers seem problematic. I can't easily reach those modifier keys while also keeping my fingers on the home row; I have to either contort my thumb or pinky in a bad way, or move my entire hand (which is usually how I use those keys.) Either way, keeping hands straight and my fingers positioned on the home row seems much safer and comfortable. I just can't imagine using a language where I have to altgr for every character I type.
- abrudz 4y agoHasn't really been an issue. Occasionally, I map CapsLock to AltGr so I have a left-side APL shifting key too — it doesn't see much use, though. Also remember that it isn't "every character I type". Actual APL primitives only comprise a relatively small fraction of the total code. I just did a rough computation on four things I've been working on recently and they had 4%, 5%, 6%, and 7% non-ASCII APL glyphs, respectively.
- skruger 4y agoSpeaking for myself, I find that whenever I think "I just can't see how..." it makes me want to figure out what it is that others can see that I can't. This is the reason I learnt APL, actually, after seeing half a page of k code and feeling annoyed that I couldn't read it. k subsequently led me to APL. You can try it for yourself -- NumPy is a fair "Iverson ghost" -- APL without the symbols: it has a similar enough array model, and most of the APL primitives as functions or methods. APL lets you express linear algebra in a very natural way. Doing it in NumPy is much more convoluted. Or try Rob Pike's (of Go fame) "ivy" -- his attempt at an APL-with-words (https://github.com/robpike/ivy https://github.com/robpike/ivy).
- ohbtvz 4y agoSorry, I'm not embarking on a quest to learn APL because somehow the idea can't be explained.
- jodrellblank 4y agoThe claim isn't that writing is faster, the claim is that there's less pointless boilerplate to write, read, or think about. You didn't write your comment as: "quote fast unquote is not relevant hyphen the runtime would be just as fast if the code was written in plain words period code size is also irrelevant unless you apostrophe are called initial capital elon musk period the only claim left is that it apostrophe s a productivity boost comma but i just can apostrophe t see how a language that needs a special keyboard to be written can be written more productively than actual words comma especially with modern initialism ide s period" because symbols are useful. And people don't have a problem with peppering code with chorded symbols like () ++ {} : <> ? without demanding that they be turned into words because words are easier. In fact people struggle when making new languages (Rust, C# new versions) to find more symbol combinations, reaching for things like Python's triple quote strings """ """ and :: and ""u8 and so on. There's nothing inherently better about shift-2 shift-2 shift-2 shift-2 shift-2 shift-2 than altgr+i Why aren't the common operations of transforming collections short, sharp, and getting out of your way? Why are they ceremonious "map a lambda which takes a parameter with a name and ..." when you don't need that.
- gjulianm 4y ago> But readability is in the eyes of the beholder, Unfortunately, given that the program is going to be read by people, what we care is about what the beholders say. > just because I can't read Japanese does not make Japanese unreadable A nice comparison: Japanese is indeed harder to read than other non-symbolic languages. Symbols are harder to recognize because there are far more of them than letters in alphabets (latin, greek, cyrillic). For example, do you think it's easy to recognize the difference between 陳 and 陣? The more symbols you have, the harder they are to process, be it Japanese or APL.
- skruger 4y agoYet millions of Japanese people are fairly adept at reading it. To be clear, APL actually has a tiny set of symbols. In day to day use, perhaps two dozen. Remember that these aren't "keywords" in the traditional sense, but more like the standard library. Contrary to popular belief, it's actually pretty easy to learn to read, as usually the symbols are mnemonic, or referencing well-known mathematical counterparts. Flipping a matrix in various ways is a circle and a line. For example, ⍉ means "flip diagonally" -- in other words, a transpose. To flip around the horizontal axis, guess the symbol: ⊖. Around the vertical? ⌽. The ceiling of a number is borrowed from maths: ⌈ etc. Counting the elements in an array is ≢ -- evoking the symbols you scratch on a piece of paper when tallying something up.
- gjulianm 4y ago> Yet millions of Japanese people are fairly adept at reading it. Yes, because it's their native language. Doesn't say anything about the difficulty of it. My mothertongue is Spanish and I'm fairly adept at using it, and still doesn't mean that some aspects make it harder than other languages (verb conjugation, gendered nouns). > or referencing well-known mathematical counterparts. As a mathematician, other than the very basic symbols, most of the ones used in APL are not familiar, or are used in different contexts. For example, × is cross product and in APL is regular multiplication, ⍟ is logarithm even when "log" is what's used in math, and "⊥" looks to be polynomial evaluation when that's usually the symbol reserved for orthogonality. > Counting the elements in an array is ≢ Funnily enough, that symbol is "not equivalent" or “not congruent” in math. Never would have though it refers to the symbols in a paper.
- vanderZwan 4y agoRecently someone posted Decker here on HN, a HyperCard-inspired environment. It includes its own programming language, Lil, which looks like it took some APL influences but made the core design more based on Lua. Meaning the language hopefully feels familiar enough avoid scaring people off. I wonder if something that might be a way forward, similar to how lots of imperative languages now have language constructs that makes it easier to do functional programming in them: steal enough from the array languages to make other languages less bad. Or maybe that's what NumPy and Julia already are, which also would show the limitations of that approach. I dunno, I've read about array languages out of theoretical interest but never actually programmed in them. [0] https://beyondloom.com/decker/index.html https://beyondloom.com/decker/index.html [1] https://beyondloom.com/decker/lil.html https://beyondloom.com/decker/lil.html
- hoosieree 4y agoI'm extremely confident that array language features will seep into the mainstream in the same way that functional programming features have been doing for the last 10 years or so. New language designers will have to defend why they don't have array language features rather than why they do.
- deleted 4y ago[deleted]