Hacker News new | ask | show | jobs
by mxz3000 695 days ago
For the experts in this thread: is there any benefit to using these so called array languages compared to using something like numpy (or even pandas/polars) ?
3 comments

The short answer is yes. There have been many presentations on this topic that tries to explain it in various ways.

The problem is that most people who are unfamiliar with APL usually don't see the larger picture, and you need to learn the language before understanding the reasoning. But once you understand it, you don't really need to hear the arguments anymore.

One argument that may be easier to digest is that the very optimised syntax allows you to easily work with the data in an interactive fashion. This is similar to how a calculator that forced you to write 1.add(2) would be rather painful to use, even if it functionally is the same as 1+2.

In programs that you save to a file and is part of a larger project, this benefit is of course less relevant.

Could you imagine reading a math proof that used Python syntax rather than mathematical?

e.g. nested iterators/loops instead of ∀x,y ∈ ℝxℝ etc.

For a startup "using the language you know" is good advice. To be at the top of a specialist field, there are better ones.

Disclaimer: I'm no expert, just an enthusiast.

For me, the feeling of being well-designed or expertly crafted is what sets the array languages apart. Learning one concept often (intuitively, for me at least) extends to many other parts of the language.

For example, in Q the comma operator concatenates arrays:

    q) 1 2 , 3 4 5  // returns 1 2 3 4 5
...but it also merges dictionaries (duplicated key `x gets the new value):

    q) (`a`b`c!1 2 3),`c`d!4 5
    a| 1
    b| 2
    c| 4
    d| 5
...and also joins tables by row. Sure this is "just" operator overloading, but it's so deeply ingrained in the language it doesn't feel jarring or bolted-on like in other languages.

Building a program is less about crafting bespoke abstractions and more about using the existing building blocks, which leads to a semantic uniformity that's rare to find in other languages. Or at least, it's easier to get your job done using only built-in features and not have to resort to custom abstractions.