4 ms·
To me this looks like 'write-once and forget' code similar to a complex regexp. Why is everyone raving about the incomprehensible syntax? I admit that this is
by imbusy111 8y ago
To me this looks like 'write-once and forget' code similar to a complex regexp. Why is everyone raving about the incomprehensible syntax?
I admit that this is the first time I see APL code.
- coldtea 8y ago>Why is everyone raving about the incomprehensible syntax? I admit that this is the first time I see APL code. You've answered your own question. It's only "incomprehensible" if you're not familiar with it. After you've studied it it is very powerful and very succinct. The article even gives an example: Just consider the extract !'\:/:. The ! operator means rotation in this context. If used as n!v it rotates the vector v by n. But we do not directly use the operator like that, we modify it using the adverb ', which generally denotes a f unctional map. Now we can do something like n!'m to rotate each row vector in the matrix m, that is each element of the vector of vectors m, by n, or more generally we can say something like v!'m to rotate each row m[i] in the matrix m by the corresponding element of v[i]. A good analogy I would give is the equally "cryptic" to the uninitiated, but equally fast and powerful, to those that mastered them, vi(m) text manipulation commands -- which also use a very similar concept of modifiers and targets and so on.
- sethrin 8y agoThe following video is probably reasonably well known, and I wish that I had a more intelligent commentary than to say that it blows my mind, but it does I think bear out the point of expressivity rather well. https://youtu.be/a9xAKttWgP4 https://youtu.be/a9xAKttWgP4 Conway's Game of Life in some 50 characters of APL.
- userbinator 8y agoThe analogy I like to think of is that APL is incomprehensible to users of more Latin-based programming languages in the same way that Chinese is: you have to learn it to use it. ...and once you learn it, it feels as natural as any other language.
- gh02t 8y agoAlso worth noting that APL isn't totally foreign. Numpy, Mathematica, MATLAB etc. draw inspiration from APL in their array manipulation. Maybe not so much syntactically, but logically.