Earlier quoted context omitted.
With 5 to 10 lines of comment per one line of code, it starts to become readable. You're still left constantly wondering "what do a and x mean in this context, again?" 3/10, would definitely not want to use for any kind of real work.
John Earnest links to his tutorial in the Stages of Denial post; if you click it and give it a read, you'll probably understand much easier. But you shouldn't feel pressured to use k: people who advocate for k play the role of a Cassandra who can drown her tears in dollar bills.
Stages of denial in encountering K
151–160 of 432 posts
Re: Stages of denial in encountering K
#152Earlier quoted context omitted.
https://en.wikipedia.org/wiki/Write-only_language >Languages that are often derided as write-only include APL, Dynamic debugging technique (DDT), Perl,[2] Forth, Text Editor and Corrector (TECO),[3] Mathematica, IGOR Pro and regular expression syntax used in various languages.
You've got me wondering about the utility of a genuinely write-only language. As a thought experiment, would there be benefit to letting functions only be written once? No-one could come along and break code by changing a function. If you wanted to fix a bug in a function you would have to write a new copy and explicitly update callers to use the new version. A lot of maintenance overhead? Possibly, but tooling would…
Re: Stages of denial in encountering K
#153> +/!10 I personally find the given example harder to read than the equivalent in python/matlab/javascript with lodash/probably many other languages sum(range(10)) sum(1:10) With "K", you have to know a few new conventions. In the second case you just have to read, and the data flow is more obvious.
Yes, but as you multiply that difference 100 or 1000, the advantages of the concise notation become obvious.
Re: Stages of denial in encountering K
#154People are so quick to reject K and APL-style languages for superficial reasons that they never get to the deep and interesting reasons! I am mostly familiar with APL, but I think the things I appreciate and dislike are about the same in K. One interesting philosophical difference, at least among some APL programmers, is that building abstractions should be avoided. TFA has a hint of that philosophy, in its suggestio…
https://github.com/indiscible/qmandel
And Arthur's version in k (also below):
I should convert it to k9 (Shakti)...
+/~^+/b*b:49{c+(-/x*x;2**/x)}/c:-1.5 -1+(2*!2#w)%w:10Re: Stages of denial in encountering K
#155Re: Stages of denial in encountering K
#156I have fallen in love with this language. How I do replace Java(Script) with this?
Re: Stages of denial in encountering K
#157Earlier quoted context omitted.
This is what - I presume - is their implementation of sending an e-mail E:[u:();e:{a::?[a;x;y];J( x)+#y};cz:{$[#u;e/_`u;]};kx:{u,:,(j,j+#x; k_a);e[k]x};kb:{$[=/k;J j-1 0;];kx""};cx:{kx cc`};cv:{kx@9'`}] A:[w::_W%F;j:: k;k:0 0;J:{k::2#0|x&#a};lx:{J j+x};y::V+F 0,j;z::1'(V;w[1]$a)],E U:{(`Z,'!Z).'+x};V:0;i:0;I::`Z,(!Z)(#Z)!i;y:{I .`y};zf:{$[`kt= x;i+:1;^`W`F? x;I . x;. x]};u::F[0] !#Z;W:{U`V,,u,'0;U`W,,(-':1_u, x),'x 1…
I tend to agree: falls into the category of "just because you can, doesn't mean you should." Actually, that's perhaps a bit harsh. I have some pretty obscure hobbies, and there's certainly nothing wrong with doing this sort of thing if you want to. Still, having done so it's a bit rich to then look askance at the rest of us like we're all idiots for not choosing to go down a similar route with our own systems.
The reason we have Python, Javascript, and Java is because most people (including me) just aren't bright enough to work fluently in these terse APL-alike idioms.
They fail because it's hard for most people to keep that many terse symbols and symbolic relationships in memory at the same time, without English labelling and all the other usual memory aids.
(In fact basic functional programming is a bit of a stretch for the average commercial developer.)
An interesting hypothetical is what a language would look like if it needed an extra 60 IQ points...
Re: Stages of denial in encountering K
#158Earlier quoted context omitted.
So then, why is K less popular than pretty much any other language? Because people are stupid? Uninformed? There's a lack of PR-minded people working with K? What exactly is your theory? It's funny that a language this flawless is slightly less popular than S or D or pretty much any other one-letter language. There must be something that makes it unappealing for the masses of programmers - what is it?
Masses love javascript. Just saying. More seriously, core language quality is not the primary driver of language choice. Otherwise we'd all be using something with S-expressions, Hindley-Milner, dependent and linear types. ducks
Do note that I didn't claim "popularity == quality". I'm not even claiming K is bad!!! Just that it's strange for something so clearly superior to everything else to be such a niche language. Surely it must have downsides...
Re: Stages of denial in encountering K
#159A million-line program isn't readable by anybody, no matter how readable the language is. If the equivalent program can be written in, say, a thousand lines in some more concise language, that's more than worth the learning curve, even if the language is strange and off-putting.
I doubt that K can reduce line count by a factor 1000 though. The examples in the article is mostly about shorter identifiers like "!" instead of "range" and a compact notation. That is perhaps a factor 5 not a factor 1000. The example with a for-loop for summing a range is a blatant strawman. In which modern language would that be idiomatic? Furthermore the examples only show a particular use case: Processing lists…
Golang?
Oh, you said modern. Never mind.
Re: Stages of denial in encountering K
#160“ and you can add 5 to an entire matrix at once as easily as a single number. Why you would want this property remains elusive-...”. Why would that be elusive I wonder ? MATLAB has been doing it since the 80s as an example and that exact elusive feature would have been used countless times.