Klong was among the languages I looked at when I was trying to pick a language for a project (ongoing but back-burnered at the moment). Ultimately I went for Dyalog APL, but looking at the documentation - and the great website - for Klong I found it quite... charming? If you're familiar with the array paradigm it's pretty straightforward.
Unrelated editorializing - Klong has come up in passing on the Array Cast [0] before, but I'm surprised they haven't interviewed Holm. They seem to be doing less of the "forbears tell awesome stories" episodes lately. Which is a shame because that's probably the single best sub-set of Array Cast episode types...
> If you don't know any array languages, it might explode your brain. Use at your own risk!
I've been around the block, don't think it'll be a problem picking up something new
> Here is a program that checks whether a number x is prime (for x>2): {&/x!:\2+!_x^1%2}
(closes laptop and goes outside)
There's a niche out there where this kind of technology is appreciated. I can even appreciate the technical challenges in making an array language interpreter run fast!
However, unfortunately, the notation is so terse that I can't imagine spending the time to learn this. This looks write-only.
Is there an obvious reason to prefer a k-like language like Klong, over e.g. Futhark[0] or Accelerate[1]?
I wonder if these extremely terse languages might see a rise in popularity with LLMs, since they save a lot of tokens. The hard part would be training on them, since training data is not as comprehensive as JavaScript, for example.
Fun times! :)
No idea why emorning3's comment is marked [dead]. It's a good question and in fact Klong arrays are very much like S-expressions. In fact their implementation is pretty much the same, down to using CAR and CDR to manipulate them. Klong could easily be implemented as a bunch of LISP functions and macros.
I wonder how much overlap there is between users of array languages and of scientific programming languages/dialects like MATLAB, Numpy, and Julia, which are also optimized to operate over arrays. In other words, do K/Klong/whatever proponents realize that there is already a huge community of people who appreciate and utilize powerful operations on arrays to do real work, but just prefer to write something like "max(diff(x))" instead of "|/--:'x"? It's almost the same number of characters and it doesn't require learning a new writing system.
First line of https://t3x.org/klong/prime.html
"The braces around an expression denote a function. Because this function contains a single variable, x, it is a monadic function or a monad."
I never understood that about monads, even if it's litterally their name.
Google tells me that Klong and Lisp are not the same thing.
But can someone tell me why an array in Klong is NOT like an s-expression in Lisp?...
> If you try to use it like your favorite functional/procedural/OO programming language, you will only get frustrated.
For me personally, the sentence could be shortened to just: "If you try to use it, you will only get frustrated."
I think that the vast majority of people who complain that these languages are unreadable and who insinuate that people who use and like them are basically just showing off are fundamentally uninterested in the possibility that there are possible positive trade offs to this style but for those who are genuinely interested in why some people like to program this way: Imagine having to do math with no symbols. that means 1+1 is now one plus one. Now imagine having to do that in the context of graduate levels mathematics. I am quite sure nobody calls a2+b2=c2 unreadable as compared to a squared plus b squared equals c squared and I dont know any one who wants to do algebra that way. Well the same principle is why array programmers like this style. I dont expect you to take my word for it im just letting you know what these other weird crazy people see in array languages that you dont. This allows one to think faster and further than they could encumbered but a heavier syntax. Is this way of programming the best no. Should everyone learn it no. Are there trade offs yes. Is it worth your time, quite possibly not. But thats true about literally everything in programming.