3 ms·
It's not about terseness, it's about making easy to see patterns and what is going on. You probably learnt the distributive property in school: a*(b+c) = a
by yiyus 5y ago
It's not about terseness, it's about making easy to see patterns and what is going on. You probably learnt the distributive property in school:
a*(b+c) = a*b + a*c
Let's make that "more readable":
equals(multiply(a, sum(b, c)), sum(multiply(a, b), multiply(a, c)))
It's not about the terseness, I just don't see a clear pattern using the "readable" notation. But it is obvious when using symbols.
You can find another interesting example at: https://wjmn.github.io/posts/j-can-look-like-apl/ https://wjmn.github.io/posts/j-can-look-like-apl/
- seppel 5y agoBut it is the switching from infix operators to prefix operator that is making the second example less readable (and the implicit precedence of the operators). Writing it as (a times (b plus c)) equals ((a times b) plus (a times c)) would be a fair comparison, which is much more readble than =(*(a, +(b, c)), +(*(a, b), *(a, c)))
- yiyus 5y agoFair enough, the change from infix to prefix was misleading. But do you (or anyone) find (a times (b plus c)) equals ((a times b) plus (a times c)) easier to read than a*(b+c) = a*b + a*c ?
- civilized 5y agoI like the idea that APL could provide this advantage but I just haven't seen any compelling examples. And that's my experience with a lot of APL stuff - beautiful theory that just doesn't quite seem to deliver on the promises. It feels like the Zen of APL is "symbols are a freaking great idea, let's do more of those!" when intellectual communities that are heavy on symbolic manipulation are generally quite conservative in the introduction of new symbols... let alone the dozens that APL introduces. To each his own and all, but APL might have to content itself with a small group of devoted fans.
- yiyus 5y agoI absolutely agree with you about the introduction of new symbols. Most glyphs have been there for decades now, and there is a high barrier to introduce new ones. There are Dyalog developers who experiment with new primitives that use new glyphs, and it takes years until they are actually introduced into the language, if ever. Very clever people have been working in array languages for more than 60 years, and there is a set of around 20-30 primitives that all of them agree are worth to have. Depending on the array language of choice, there are another 10-40 primitives more. Symbols have double use (monadic and dyadic), so that makes a total of 20-40 symbols to learn, and you already know many of those (+-×÷=<>, and probably a few more). To each his own indeed. But if you haven't, I would suggest you to give it a try. It makes much more sense once you start writing code.