Hacker News Comments on
Patterns and Anti-patterns in APL: Escaping the Beginner's Plateau - Aaron Hsu - Dyalog '17
Dyalog Usermeeting
·
Youtube
·
2
HN points
·
5
HN comments
- This course is unranked · view top recommended courses
Hacker News Stories and Comments
All the comments and stories posted to Hacker News that reference this video.Aaron Hsu’s talk on APL - I think this talk - https://youtube.com/watch?v=9xCJ3BCIudI - has a more radical interpretation; by the time you’re using lisp to compose lightbulb apis and Bluetooth stream hacking, you’re already past the point of divergence that you mention and are on the wrong side of it.APL does the hard part of choosing composable functions and presents those to the user, as a simplified interface. Sorting isn’t a global namespace of thirty different sort algorithms so you can delight in picking the exact one you want, sorting is one character (⍋) so you can use it as a composable building block and not care about the details.
I might agree that the core issue is that programs have become less composable over time - but what you ask for doesn’t seem to address that at all. Part of the job of designers and creators is to make simplifying decisions on behalf of users; I don’t want the lightbulb raw interfaces to be exposed to me as an alternative to a crummy closed app product, I want a well designed composable app product as the api I use - all at once, so I don’t have to care about negotiating access tokens or header padding anymore than I have to care about LED heat dissipation or mains smoothing inside the bulb when I flick a light switch.
For composition I want Lego not a machine shop, and I accept compromises in ability to get that. I want grep not fopen().
When you say you want composition what you’re asking for is a machine shop; not a bad thing to ask for, but completely different from where you started out with Unix shell composing of finished product programs which you originally said you wanted.
@ddragon your points are well taken. I will look further into Julia. I still think when I wrote "out of the box" with APL in mind as far as expressing math, or J for that matter if you learn the ASCII symbols. I've seen other examples since your post on Julia that show similar math expressiveness, but they seem to rely on libraries or the syntactic sugar provided by the libraries. I haven't tried your example, but it looks like vanilla Julia. My familiarity with Matlab makes Julia an easy choice for me too.Here is a simple example in J:
+/ % #
The above is an average function in J. It is a fork, where you fold right over the input (+/), and divde (%) by the tally (#) or count of items, so that
(+/ % #) 4.5 3 2 12
produces 5.375 as the average of the input vector. Notice the array-based language deals with singular quantities or scalars, vectors, and multi-dimensional arrays as fundamentals of the PL.
You could also define it as:
average =: +/ % #
for those who make the readability argument, however, you learn math symbols and read math papers full of them, and not lengthy verbal descriptions of these math formulas (average is equal to the "sum all of the input elements, and divde by the count or tally of input items").
The fact that a highly-functional APL program can fit on one screen negates the argument that you need readability, so that when you pick up or someone else picks up, your 110K lines of JavaScript code they can make a change. You may have to do a refresh read in APL and J, but because it is terse, you can deal it pretty quickly. Well-commented code in the 100k to 1 million lines of code scale will never allow one person to see the whole picture.
The work by Aaron Hsu in APL is amazing. Here is a link to the slides from a talk he gave. It's a bit lengthy but I found it very interesting and appropriate to this topic:
https://sway.office.com/b1pRwmzuGjqB30On
The YouTube link to the talk is here:
For those who do not use Javascript in the browser, here is another source of the presentation:https://www.youtube.com/watch?v=9xCJ3BCIudI
Lots of good commentary not in the slides.
And here is a way to download the video without Javascript. I have been meaning to try to rewrite this in k.
# Notes # Works by brute force and has been reliable for years # Was easily updated when YouTube made changes (rare) # Zero dependencies except tr, sed and an https client # Takes a YouTube URL on stdin # Example usage: # echo http://www.youtube.com/watch?v=9xCJ3BCIudI|ytd 22 file # "ytd" is name of the script # "22" is itag-no in this case large mp4 ("18" is smaller mp4) # "file" is optional filename, no extension required # if no filename given video is saved as "1.mp4" # UNIX-like: url-filter < file-containing-url|ytd 22 # Caution when copying and pasting: line 2 needs to retain the 4 space indent # N.B. Will not work with restricted videos; *this is not for downloading music or other commercial crap*; use youtube-download if thats what you are after # N.B. Some videos may require a few tries, most will work on the first try; if get 403 try again #!/bin/sh case $# in [123]);;*)exec echo usage: $0 itag-no \[file\];esac;a=$(exec sed 's/http:/https:/;s/m.youtube/www.youtube/;s/youtu.be./www.youtube.com\/watch?v=/;s/hooktube.com/youtube.com/;s/embed./watch?v=/;#etc.;s/?version.*//;s/;.*//'); n=0;while true;do b=$(curl $a|exec tr -cd '\12\40-\176'|exec sed 's/https%3A/\ &/g;s/ *//;/ https%3A%2F%2F/!d;s/%3A/:/g;s/%2C/,/g;s/%2F/\//g;s/%3D/=/g; s/%3B/;/g;s/%3F/?/g;s/%26/\&/g;s/\\u0026/\&/g;s/%252C/,/g;s/%252F/\//g;s/%22/\"/g; s/%255B/[/g;s/%255D/]/g;'|exec sed '/itag='"$1"'/!d;/video.mp4/!d;/webm/d;/ytplayer/d;s/;+codecs.*//;s/&xtags.*//;/timedtext/d;s/&itag=..//2');test ${#b} = 0||break;test $n -le 9||exit;n=$((n+1));done;case $1 in 18|22)ext=mp4;esac;exec echo curl $3 -4o ${2-1}.$ext $b;
⬐ feelin_googleyCorrections: 1. remove "echo" from line #2; 2. add " -v" after "curl" in line #2 so one can see occasional 403 errors.
Two talks with these slides:1. https://www.youtube.com/watch?v=9xCJ3BCIudI (Dyalog17: Patterns and Anti-patterns in APL: Escaping the Beginner's Plateau)
2. https://www.youtube.com/watch?v=v7Mt0GYHU9A (Design Patterns vs Anti pattern in APL by Aaron W Hsu at FnConf17)