4 ms·
I keep hearing APL is great, but like everyone else I find the cryptic symbols very off-putting. I haven’t seen a really compelling explanation for why it’s gre
by iainmerrick 8y ago
I keep hearing APL is great, but like everyone else I find the cryptic symbols very off-putting. I haven’t seen a really compelling explanation for why it’s great.
It looks like a bunch of matrix and vector functions with very terse names. Is it significantly different from just taking GLSL, say, and #define-ing one-character names for all the built-in functions? What is APL’s secret sauce?
This article suggests that a lot of the fun is just the cryptic symbols themselves. That’s absolutely fine, but it doesn’t seem like something that “deserves” a renaissance, compared to, say, Lisp, which really does have a uniquely productive idea at its core.
- zokier 8y agoIf you don't like the symbols then there are J and K/Q which are ASCII based but retain many of APLs other characteristics. https://en.wikipedia.org/wiki/J_(programming_language) https://en.wikipedia.org/wiki/J_(programming_language) https://en.wikipedia.org/wiki/K_(programming_language) https://en.wikipedia.org/wiki/K_(programming_language)
- 49bc 8y agoIf you lose the symbols you lose the terse nature of the language, which as far as I can tell seems to be one of the most alluring parts of the language (the author of the blog post shows game of life as essentially a one-liner).
- omaranto 8y agoDid you read any J programs? It is just as terse as APL. (Probably K is pretty terse too, but I won't comment on it as I only know J.)
- vorg 8y agoIn J, the parens, brackets and braces aren't balanced because those 6 symbols, i.e. `(`, `)`, `[`, `]`, `{` and `}`, are used as standalone symbols for other syntactic stuff, making J code very hard to read.
- omaranto 8y agoParenthesis are paired and have their usual function of groupoing. You are correct about brackets and braces though. Personally I do think J is often hard to read, but not because of the unbalanced brackets and braces.
- klibertp 8y agoNo, parens are parens, used for grouping. The rest is true, though: brackets `[`, `]` are essentially two flavors of identity function (dyadic) and `{`, `}` are indexing operators (not sure I remember right, but I think `(<1;2) { A` would be `A[1][2]` in more common languages).
- lobster_johnson 8y agoJ and K are extremely terse, though. They just chose other ASCII symbols that exist on everyone's keyboard.
- iainmerrick 8y agoI just don't think the symbols are all that important. I'm curious about the key ideas behind the language, but I haven't seen a really good explanation of them. Is it just a set of well-chosen matrix operators? I would have thought that could be done in a library, rather than a language.
- icen 8y agoThere are two key ideas: one is notation as a tool of thought, and thus the symbols are incredibly important (or, if not using symbols, to use similarly lightweight notation as in j/k). In a semantic sense, the key idea is that you compose operations on array indices. A good example of this is k's where operator, &, which converts an array of booleans into an array of indices where it is true. It's very common to take & of some predicate on your inputs, manipulate that for a while, and then index into something else at the end. There are also ideas of rank/shape ambivalence, which naturally encompasses broadcasting (so scalar + vector broadcasts the scalar, vector + matrix broadcasts the vector row-wise, etc). You certainly can implement something with APL's semantics as a library - Numpy does this. The magic of using APL comes from having all these features at once.
- iainmerrick 8y agoGreat, thank you! Food for thought and some concrete stuff to research further.
- deleted 8y ago[deleted]