[HN Gopher] Learning APL
       ___________________________________________________________________
        
       Learning APL
        
       Author : todsacerdoti
       Score  : 77 points
       Date   : 2021-08-06 20:01 UTC (2 hours ago)
        
 (HTM) web link (xpqz.github.io)
 (TXT) w3m dump (xpqz.github.io)
        
       | skruger wrote:
       | Author here. I wrote this because I thought APL deserved an up to
       | date introductory text. It's basically the notes I kept when
       | learning it myself. Stoked to see it on HN.
        
       | queuebert wrote:
       | Don't flame me, but I think APL is the perfect language to
       | introduce coding to kids. I've had great success with it
       | personally. The symbols are suprisingly intuitive to them, and
       | APL's strengths match the domain of what kids typically do with
       | computers at first.
        
         | rak1507 wrote:
         | Interesting! Aaron Hsu agrees.
         | https://www.youtube.com/watch?v=kIItfQJEVdM
        
         | leephillips wrote:
         | I don't think you're wrong at all. I was not a kid at the time,
         | but APL was the first language I learned. There is one
         | drawback: it kind of spoils you. If you continue to do any
         | programming you'll probably have to use other (inferior)
         | languages, and you'll always miss APL.
        
           | blowski wrote:
           | That's why I recommend starting with GW-BASIC like I did.
        
             | queuebert wrote:
             | GORILLAS.BAS represent!
        
               | shaunxcode wrote:
               | Oh man memories of figuring out how to change the wind
               | speed and feeling like a hacker for the first time!
        
           | vanderZwan wrote:
           | > _it kind of spoils you_
           | 
           | I think in some way anyone's first language will spoil them
           | for whatever that language is best suited for. My "first"
           | language was Z80 assembly, because I wanted to make games for
           | my calculator (I ended up writing just one[0], also "first"
           | because technically my first was TI-BASIC of course). I've
           | missed feeling like I directly was speaking "to the metal"
           | ever since. Don't get me wrong, I'm super-happy with the
           | high-level languages I've used since, but whenever I have to
           | wrangle efficient code out of JavaScript there's some
           | (probably misplaced) nostalgia for when I didn't have to
           | worry about whether or not the JIT will kick in or not.
           | 
           | [0] https://www.ticalc.org/archives/files/fileinfo/328/32817.
           | htm...
        
         | vanderZwan wrote:
         | Well, the Snap! people seem to agree, since it's available as a
         | library there, as I discovered just a few hours ago:
         | 
         | https://twitter.com/nathrune/status/1423703525612212232
         | 
         | That actually sounds like quite a powerful addition to Snap!
        
           | shaunxcode wrote:
           | that is beautiful!
        
         | jazzyjackson wrote:
         | It may also appeal to children who desire to read and write in
         | a secret code language (seems like a phase some of us have,
         | anyway!)
        
           | bryanrasmussen wrote:
           | so maybe the first language should be brainfuck.
        
             | cyberbanjo wrote:
             | i think it's lack of expressive power will turn off newbies
        
       | DaedPsyker wrote:
       | Can I ask, why has APL suddenly become the flavour of the month?
       | This isn't a downer on the language, I'm just genuinely curious.
        
         | mlochbaum wrote:
         | It happens like once a year, it's not that sudden. That said,
         | Learning APL looks like an outstanding resource when other
         | introductions to Dyalog are outdated, incomplete, or just low-
         | quality, so I think it deserves to be highlighted even if
         | everyone's otherwise tired of hearing about APL.
        
       | joeman1000 wrote:
       | This is really cool. I'm glad I didn't get too far into learning
       | it now, I can use this guide happily! Thank you for your effort
       | in producing it.
        
       | civilized wrote:
       | Here's what I don't get about APL. Why is it so important that
       | everything be a single symbol? Why not give the symbols more
       | descriptive names and let people use those names, instead of
       | being forced to work with only the symbols? Heck, it wouldn't be
       | much work to make a text editor that lets you switch back and
       | forth.
       | 
       | APL seems to be designed for people who place an extremely,
       | extremely high weight on code golf-level terseness. IMHO,
       | terseness isn't the be-all, end-all of comprehensibility. I'd
       | rather just use the words "max" and "min" than learn redundant
       | special symbols for the same that save me a couple characters.
        
         | rak1507 wrote:
         | https://code.kx.com/q/ uses words for a lot of things. Instead
         | of the APL [?]/ you write 'max'. Instead of the APL [?]\ you
         | write 'maxs'. And so on.
         | 
         | Personally, I much prefer the APL for a few reasons. If I tell
         | you that +/ is sum, you can reasonably guess what product is.
         | (x/).
         | 
         | However, in q, if I tell you 'sum' is sum, can you guess what
         | product is? Well, maybe. But it's prd. Would you have guessed
         | that first try?
         | 
         | This seems like it might not be that important, and obviously
         | to the q developers it isn't. But it is a consideration that
         | logically leads to terse symbols.
         | 
         | If you had to write reduce(plus, arr) every time of course
         | you'd rather have a word for 'sum', it's only because of the
         | symbols that let you decompose larger problems into the smaller
         | primitives without ending up with _more_ verbose code than
         | other languages.
        
         | Jtsummers wrote:
         | The history of APL is helpful to consider. It, initially, was a
         | notation for describing computer systems and programs, and its
         | use as a programming language came later (though not greatly
         | later).
         | 
         | If you want something APL-like but without the symbol heavy
         | nature, the nearest is going to be languages like Haskell that
         | similarly promote tacit programming but without quite as heavy
         | a reliance on symbolic notations, or descendent languages of
         | APL like q.
        
         | jodrellblank wrote:
         | It wouldn't take much work to make a text editor that lets you
         | switch this:                   if (username == "alice") {
         | results[5] = true;         }
         | 
         | into this:                   if username valueequals
         | STRINGaliceSTRING begin             let results index 5 be true
         | stop         endif
         | 
         | because symbols are incomprehensible, words are much clearer,
         | and you don't care about saving "a couple of characters" and
         | you don't like codegolf. Would you use it? If not, why not? How
         | do you know the amount of symbols you use is the perfect amount
         | and not merely the amount you are habituated to?
         | 
         | > " _Why not give the symbols more descriptive names and let
         | people use those names_
         | 
         | For the same reason almost nobody wants {} to be BEGIN/END; the
         | symbols are so ingrained, so well understood, so automatic and
         | habitual that there's no benefit to trying to turn them back
         | into words. Why not move towards doing the same for other
         | common operations? Once you've used [?] as floor and [?] as
         | ceiling, Math.Floor() feels like a drag. Once you're familiar
         | with 4|list to get the first 4 items, list[0..4] is a drag and
         | it has more symbols! list.take(4) has more symbols and is no
         | clearer. How do you stop a forever-expanding proliferation of
         | symbols? I don't know, but APL seems to have done a
         | surprisingly good job of general purpose computing in under ~80
         | symbols which has hardly grown in 70 years.
         | 
         | > " _APL seems to be designed for people who place an
         | extremely, extremely high weight on code golf-level terseness._
         | "
         | 
         | Would you be surprised that this is valid Dyalog APL for a
         | function to find the highest value in an array of positive
         | integers?                   result-findMax data
         | max-0         :For i :In data             :If i>max
         | max-i             :EndIf         :EndFor              result-
         | max
         | 
         | then                         findMax 5 1 2 3 5 6 3 1
         | 6
         | 
         | Dyalog has keywords, classes, namespaces, methods, libraries,
         | and they get laughed at because who wants :EndFor . It's a bit
         | of a PR issue - if you head to APL it's largely because you
         | like golf, because if that's not what you want you may as well
         | use Python/etc. But once you get there even if APL remains too
         | opaque to use for everything it becomes annoying to know a
         | short way to express what you want that you are comfortable
         | with and have to laboriously boilerplate it out in another
         | language with many lines, and have those lines contain more
         | symbols into the bargain. And we say that one of the hard
         | problems is "naming things", symbols and tacit programming can
         | help avoid putting a name to variables that only hold some
         | intermediate state you don't actually care about but need for
         | the next couple of lines.
        
         | mlochbaum wrote:
         | If you're used to it, I'd guess you can read about five symbols
         | in the time you can read a short name. And you can use the
         | higher-level pattern-recognition skills that would otherwise be
         | applied to reading names to understand combinations of symbols.
         | At least for me it's much easier to visually manipulate symbols
         | in my head.
         | 
         | You've written as though using symbols instead of names comes
         | at an extraordinary cost. Having used both I don't think this
         | is the case (and it's the conventional languages that _force_
         | you to use words; you 're free to define reverse - [?] in APL
         | but usually not the other way around). If you want to read more
         | about this perspective, you could check out my page "What is a
         | primitive?" discussed on HN yesterday:
         | https://news.ycombinator.com/item?id=28060423
        
         | rajandatta wrote:
         | The best way to think about this is that all of these variants
         | exist:
         | 
         | APL uses custom glyphs
         | 
         | J uses symbols from an ASCII keyboard - its a big set of
         | primitives
         | 
         | Q from Kx systems uses words.
         | 
         | The conceptual basis for the languages is very simple. As
         | others have said - your experiences will guide where you feel
         | most comfortable.
        
           | rajandatta wrote:
           | Commenter here ... meant to say 'The conceptual basis for
           | languages is very similar'.
        
       | jboy55 wrote:
       | I had given myself a project of writing my interview phone screen
       | coding question in as many languages as I could, more as a lark,
       | but also in 'prep' for a candidate being 'funny' when I say 'use
       | whatever language you are comfortable in'.
       | 
       | I did APL, which was fun, and easy. However in researching the
       | language I came across some IBM accounting source code written in
       | APL. It really clued me into how the language got such a
       | following in HR/Finance applications. You got an array of
       | everyones hours per day. Weekly total hours, pay, tax, medicare,
       | etc, were all broken out in little calculative statements based
       | on the array of hours. So rather than long strings of APL
       | characters, there was just massive amounts of english and these
       | little digraphs or trigraphs of APL for the calculative values.
        
       | threatofrain wrote:
       | What is the most popular and optimistic APL'ish community today?
        
         | chrispsn wrote:
         | The APL Orchard and The K Tree.
         | 
         | https://chat.stackexchange.com/rooms/52405/the-apl-orchard
         | 
         | https://chat.stackexchange.com/rooms/90748/the-k-tree
        
       | emmanueloga_ wrote:
       | Here's a silly idea... could APL be to [programming language]
       | what emmet.io is to HTML and CSS? :-)
       | 
       | I imagine writing an APL expression that expands to, say, 100
       | lines of C++ :-p
        
       ___________________________________________________________________
       (page generated 2021-08-06 23:00 UTC)