Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

https://en.wikipedia.org/wiki/K_(programming_language)

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).

 help



> more overloaded than Perl by someone who maybe isn't so great at clear communications.

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).


It's clear that the symbols want to have one meaning each, for monadic and dyadic use, but that might mean quite different execution and types.

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`).


wasnt there another post about using these eso lang as intelligence tests for AI?

Reading that certainly requires more than symbol shunting.


> by someone who maybe isn't so great at clear communications

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.


Sad that the Wikipedia page links to some specific commercial service rather than the actual programming language runtime (which appears to be AGPL-licensed).

the original implementations of k were all proprietary

there are a few open source implementations as well by now

https://wiki.k-language.dev/wiki/Running_K


I think of K like a super-geeky version of Excel, for people who do quant stuff. People do very useful, cryptic stuff in convoluted, bespoke Excel sheets, updated and grown over decades with 37 variants of almost-but-not-quite the same VB function, etc. I imagine the K world is very similar, except K users can meet in London pubs and trade little snippets of K handwritten on scraps of paper between them like Pokemon cards.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: