And you start reading something so incomprehensible that you start to wonder if there's just this universe hiding in plain sight directly under the universe you've always known.
That is the precise feeling I get when I trying to understand this post.
Don't get me wrong, I appreciate the exposure, but damn if I'm not sweating trying to understand why this all matters.
> Ah, APL/J/K. Time for my annual crisis of thinking everything I've ever learned about programming is wrong...
Still, though, I'm always happy when it comes up on HN for a little discussion. As I recall there were a couple people working on a new OS or something based on K, I think. I wonder whatever happened to that.
As for this particular post, I get how `x^x*/:x:2_!100` works now (it's cute!), but it seems pretty wasteful. It's generating 10,000 products to filter out of the list of 100 integers. But 99 x 99 isn't anywhere near a number in the original 2..100 list! You only need to go up to 2 x 49, 3 x 33, etc. I wonder if there's more of a "triangular" shape you could generate instead of the full table.
Ah of course, of course. Trivially, even. Who are we to question the shallow odometers, really?
As far as I can tell, it seems to be something halfway between TempleOS and MUMPS but its a programming language instead of an OS. I don't think you are missing some deep meaning. Its more that this is written in an esoteric language which seems to be more overloaded than Perl by someone who maybe isn't so great at clear communications. He's just looking at ways to make more efficient code in K (the language). But it does look sort of like he is talking about math theorems (he isn't).
I have the same feeling. The root of K is APL, but to avoid special characters (I assume), the same symbol has multiple meanings (overloaded), depending on eg. the position, the data type, and the context. The idea is that "programs should be short enough to fit in your head." The challenge is, similar to Perl and Regex syntax, it's very hard and often cryptic to read.
I do think a concise syntax is useful, for a programming language. But at the same time, the syntax should be readable, and that probably means that each symbol or operator must only have one meaning, and that meaning should be (more or less) obvious.
K is an array language. Even an integer is actually an array of one element. I think that makes sense for a tiny language: This is the simplest possible type system. You can even support strings, when using eg. metadata or using a heuristic like "a string is always zero terminated" (which is what I used for my tiny language).
For example, & is monadic 'where' and dyadic 'min' (a logical extension of it being AND on bit-booleans), but this means you get different semantics, even if they all capture the 'where'-ness:
1 3 ~ &0 1 0 1 / when applied to a list, gives the indices of true elements
`b`d ~ &`a`b`c`d!0 1 0 1 / when applied to a dict, gives their keys
In both cases, you get that `x@&x` works, as `&x` will yield appropriate indices for `x`, but what that actually does has changed. In other languages, these would be spelled very differently, and so do seem like an overload, but sometimes it is just a point of view.As for why it's obvious- it's not, really, but it's no less obvious than the word `where`, and you have already learnt it, as it is (as it seems to me at least) to be punned on the C syntax (same as `*`, which gives `first`).
Reading that certainly requires more than symbol shunting.
I don't think that's fair. If you're familiar with the programming language, his writing is fairly clear. If you're not, maybe you're just not in his target audience.
IOW, optimizing his text for people familiar with the language is probably a better choice than teaching the language, which would distract him from his goal.
I don't know array based languages well but I want to read the next one.