by aaaaaaaaaab · 8y ago · 0 comments
You do APL like you do mathematics: sit down with pen & paper and think. And yes, many times it’s hit-n-miss, and someone walking by will tell you how it’s trivial with technique X you were unaware of. But again, this is how people do maths too: Maxwell’s original set of equations for electromagnetism were 20 differential equations, and it was later that Heaviside came by and rewrote it in its concise vector form we all know. (And those four equations can still be simplified to a single equation via geometric algebra! https://en.m.wikipedia.org/wiki/Mathematical_descriptions_of... )
My experience is the exact opposite.
A few years ago when I taught someone enough K (an APLish language) to explore a data-related problem and documented it here[1].
[1]: https://news.ycombinator.com/item?id=9122299
And for what it's worth, I don't do mathematics. I write software.
The problem I have is that when I gradually get to a solution in Lisp/Ruby/Python, I end up with something which is also close to lots of other problems I want to solve (or that my manager or users ask for). In solving the problem, I've naturally built up tools for that entire problem space.
In APL, I end up building a solution which is not at all close to other problems I might want to solve. I'll take an identity, flip this, zip it with that other array, reduce it with this function, and then poof, the final step slides all the puzzle pieces together and it's perfect (and only 17 characters!), but only for that problem exactly as stated. When I get a request for something slightly different, I almost have to start from scratch.
I assume this is what the "beautiful diamond" / "ball of mud" dichotomy referred to.
You don't really start from scratch though (at least I don't): most of the time you can reuse idioms with minimal adaptation.
Do you start over from scratch in terms of your mental model or just in terms of the actual code?
I’ve found using APL helps me to generalize a problem but the underlying code will often look very different.
I have found I waste a lot of time in other languages trying to re-use components that aren’t necessarily a good fit just because I have already written them.
Substitute X/REPL.