by realo · 12y ago · 0 comments
When describing APL, people talk about the strange symbols, the mathematics, etc... but I have never seen anyone describe something I only realized after some time: APL makes you approach problems quite differently, when you are familiar with it.
I stopped thinking in 'steps' applied to the individual data points, but rather I solved the problem in my head (and writing the line along the way) by aggregating the data points into larger data objects, and then letting the data objects expand in a many-dimension universe, always larger and larger... and then I simply looked at the resulting mega-thing from a different angle, and started crushing it back along different dimensions until I finally got my answer (and my line completed). The resulting one-liner was very hard to read ... but gave me the correct result.
Inflation, Change of view-point, Big Crush. That is the core of APL.
Yeah I know... sounds crazy. But that was how APL programming felt to me, and I bet I am not alone. No other language I worked with ever triggered in me that kind of mental problem-solving process.
I've been playing with J lately. I've also been a longtime numpy user, going back to the days when it was still numarray. Maybe I'm just writing numpy in J, but I find that my approach in both languages is more or less identical: set up a vector, do some matrix operations, maybe some statistical aggregates, write down the answer.
Can you provide an example for which the APL approach is significantly different from what one would normally do? It might help me understand what insights I'm supposed to gain.
(Note your use of "write down the answer": this is a giveaway that you understand it so well that you're not even aware of your understanding, and might therefore find it hard to explain)
Although SQL is way, way more verbose than J/APL it is still extremely readable, even if the query is massive. Untrained SQL users always point to big queries as some sort of code smell when in fact most queries are logically partitioned by virtue of how they work.