12 ms·
Learning APL
- DaedPsyker 5y agoCan 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 5y agoIt 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.
- porker 5y agoThe Array Language podcast which started a couple of months ago and was featured on HN has helped.
- Banana699 5y agoAPL, forth and prolog are routinely rediscovered over and over again. They are like a cat standing in the path of a door : refusing the mainstream and refusing obscurity. Maybe lisp was in that club too but clojure made it mainstream again, by my horribly inaccurate, unscientific and probably wrong reckoning.
- vanderZwan 5y agoClojure is in a kind of "niche mainstream" position. The others are "just" niche, I guess
- rbanffy 5y agoI love how Forth taught me to build the language up instead if the program down.
- de_Selby 5y agoThat's something I like about array languages too, and Lisp is similar from what I know of it. Essentially defining a DSL for the problem and then working with it.
- Zababa 5y agoI've been reading hacker news for around two years and it's one of the recurrent topics I think. It comes in waves so we may be in a peak of some sorts, but I think it'll always come and go.
- queuebert 5y agoDon'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 5y agoInteresting! Aaron Hsu agrees. https://www.youtube.com/watch?v=kIItfQJEVdM https://www.youtube.com/watch?v=kIItfQJEVdM
- leephillips 5y agoI 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 5y agoThat’s why I recommend starting with GW-BASIC like I did.
- queuebert 5y agoGORILLAS.BAS represent!
- shaunxcode 5y agoOh man memories of figuring out how to change the wind speed and feeling like a hacker for the first time!
- vanderZwan 5y ago> 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.html https://www.ticalc.org/archives/files/fileinfo/328/32817.htm...
- civilized 5y agoHere'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.
- mlochbaum 5y agoIf you're used to it, I'd guess you can read [EDIT: was five; thought more] two to four 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 https://news.ycombinator.com/item?id=28060423
- valenterry 5y agoI doubt that it can be read much faster. Think about newspaper: you don't read the symbols that make up words - you literally read the words themselves. Taht's why it is pettry esay to fllw txet wtih miexd up caharcetrs. As long as first and last latter stay the same. One advantage is that long expressions might fit in one line, but that's about it. I mainly use Scala, which allows to use symbols like ← ⌽ as well and quite a few libraries do that - but I found unless it's a very commonly used symbol, it's not helpful for productivity.
- mlochbaum 5y ago
- skruger 5y agoAuthor 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.
- sxp 5y agoThanks for the writeup. I'm still not a fan of APL due to its non-ASCII characters, but I like the link to https://beyondloom.com/blog/denial.html https://beyondloom.com/blog/denial.html that you provided.
- moistly 5y agoI note that on my iOS iPad some of the symbols render as a empty boxes, e.g. in the Fizzbuzz example the left arrows point to an empty box. I have no idea if that is in fact the correct symbol—it could well be! (Also, I have no idea if this could be corrected.)
- moonchild 5y agoHeyo, I wrote a small critique[0] of it on lobsters. Nice stuff! Glad to see we finally have an alternative to mastering dyalog apl. 0. https://lobste.rs/s/stk8h0/learning_apl#c_g0p3y1 https://lobste.rs/s/stk8h0/learning_apl#c_g0p3y1
- alanbernstein 5y agoThanks for this. I don't know when I will make the time to learn new languages, but I think I've decided that when I do, one of the array programming languages is where I'll focus. This page seems like as good a place to start as any. The xkcd "light saber" thing made lisp seem appealing to me a few years ago, but after a brief intro to the array languages, now I think they're much more deserving of that comparison.
- jboy55 5y agoI 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.
- valbaca 5y ago> 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 would honestly love a candidate to use some esoteric/legacy/wacky/niche language to spice it up. If they can walk me through it that would be a Strong Hire in my book (assuming it actually works when I test it later).
- deleted 5y ago[deleted]
- fasquoika 5y ago>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. Yeah I guess APL is kind of 'spreadsheets as a Real Programming Language', isn't it?
- NhanH 5y agoDo you still have a link to said source code?
- 5y ago
- threatofrain 5y agoWhat is the most popular and optimistic APL'ish community today?
- chrispsn 5y agoThe APL Orchard and The K Tree. https://chat.stackexchange.com/rooms/52405/the-apl-orchard https://chat.stackexchange.com/rooms/52405/the-apl-orchard https://chat.stackexchange.com/rooms/90748/the-k-tree https://chat.stackexchange.com/rooms/90748/the-k-tree
- joeman1000 5y agoThis 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.
- emmanueloga_ 5y agoHere'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
- rak1507 5y agoCool idea, https://github.com/phantomics/april https://github.com/phantomics/april does this a bit, would definitely like to see something similar in other languages too.
- haolez 5y agoI like APL's symbols, since the code becomes easier to read. But I also like the tacit stuff from J. What should I do? :)
- cjv 5y agoHow does APL compare to J? Which one is more enriching to learn?
- skruger 5y agoI asked myself the same -- should I start with APL, J or K? I concluded that APL is the "original" from which the others draw inspiration, and so it felt most natural to start there. Note that wherever you decide to start, the experience you gain carries over to the others.
- pabs3 5y agoI wonder how many other programming languages there are that are still mainly proprietary. It seems like most languages these days have their primary implementation as open source.
- razetime 5y agoAPL's ASCII based relation, J is opensource(GPL, I think). [BQN](https://mlochbaum.github.io/BQN/ https://mlochbaum.github.io/BQN/) is a newer rationalized entry which is completely FOSS. K is another array language which has a proprietary implementation. Tcl is a relatively popular proprietary language.
- pabs3 5y agoThanks for the info/links. Wikipedia says Tcl is an open source language, did you mean a different Tcl? https://en.wikipedia.org/wiki/Tcl https://en.wikipedia.org/wiki/Tcl
- blacksqr 5y agoTcl is open-source, distributed under a permissive MIT-style license.
- rbanffy 5y agoIIRC, one key selling point of K was that it’s runtime fits inside an x86’s L3 cache.
- mlochbaum 5y agoIt's a marketing point, yes. I think it actually has no practical benefit and wrote about why here: https://mlochbaum.github.io/BQN/implementation/kclaims.html#instruction-cache https://mlochbaum.github.io/BQN/implementation/kclaims.html#....
- ano88888 5y agomy brain hurts just by looking at the sample code. Pass for now.
- yewenjie 5y agoIs there a modern APL like language with the same level of terseness but with open source implementation?
- grzm 5y agoYou might want to take a look at J, also by Iverson (along with Hui) https://en.wikipedia.org/wiki/J_(programming_language) https://en.wikipedia.org/wiki/J_(programming_language) https://www.jsoftware.com/#/ https://www.jsoftware.com/#/
- userbinator 5y agohttps://en.wikipedia.org/wiki/J_(programming_language) https://en.wikipedia.org/wiki/J_(programming_language) is probably the most well-known of them.