Live data from Hacker News

Stages of denial in encountering K

nsl.com

161–170 of 432 posts

Re: Stages of denial in encountering K

#161
post #140

what is ` the closest i got to finding some pattern is this: >>> xs '34210' >>> grade(xs) [4, 3, 2, 0, 1] >>> grade(grade(xs)) [3, 4, 2, 1, 0] # :O where grade = lambda xs: ( [i for (i,_) in sorted(enumerate(xs), key=swap)] ) swap = lambda p: (p[1], p[0]) no clue what it means though. (i guess "ordinal" really is too ambiguous...) EDIT alright, i see it now - `<<xs` is "for each item x of xs, where does x land when y…

    x: 10?A:"abcdefghijklmnopqrstuvwxyz"
     x
    "ysyselacwl"
     +`x`y`z!(x;
So <x gives a sort index, <<x tells you how far each element is from the minimum in that sort index

Re: Stages of denial in encountering K

#162

Earlier quoted context omitted.

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…

You'd essentially be semvering little bits of your code.

https://www.unisonweb.org/

Re: Stages of denial in encountering K

#163
Looks like the author figured it all out at the very beginning:

> If each punctuation character in the K is a separate part of speech, and you reverse their order

     +      /     !    100
     plus reduce range 100

This seems to be how this works. Compare that to math equations like these ones:

https://en.wikipedia.org/wiki/Maxwell%27s_equations#Formulat...

You would not expect them to read them like a paragraph. You are expect to read them symbol by symbol and unpack from the inner out.

K seems to be a dense language. Expect to read it symbol by symbol, not word by word or line by line.

If will be come more readable if you (1) slow down (2) get used to the programming patterns.

Not saying K is a good language or anything. But the frustration of the author seems to have more to do with impaticence and mismatched expectations than with flaws in the language itself.

Re: Stages of denial in encountering K

#164
post #155

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

Also Fortran and C++ Eigen matrix math library. Very useful for anything that is non-trivial math.

Re: Stages of denial in encountering K

#165
post #126

People 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…

There's a q Mandelbrot here: https://github.com/indiscible/qmandel And Arthur's version in k (also below): http://www.kparc.com/z/comp.k I should convert it to k9 (Shakti)... +/~^+/b*b:49{c+(-/x*x;2**/x)}/c:-1.5 -1+(2*!2#w)%w:10

My K is weak, but I think that implementation is also putting the fixed point iteration on the outside, isn't it?

Re: Stages of denial in encountering K

#167
post #97
post #87

Earlier 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?

k costs $20,000 per-core (less accurate now than it used to be but I'm pretty sure it's still true for commercial uses). It has a billion-dollar company based entirely around it (Kx/FD) and a smaller multimillion one, so it worked out well, I guess. J is free, but J has never had an advertising budget, and was only freed recently. APL's current leading implementation is really bad in comparison to how nice the langua…

A language doesn't cost... the environment might. Why did nobody pick up on the ideas? C# is not inspired by K, Go is not, Swift is not, Rust is not, Clojure is not... I mean, take any big or small company that decided "we need a new programming language" - I'm not aware of many taking inspiration from K.

I get it, there are people who love K, and are productive in it. And I'm not even claiming the ideas of K are inherently bad! But you know, when the rest of the world "doesn't get it", _maybe_ the reason is not that the rest of the world is dumb? Articles like this one do K no favor, IMO.. they might "feel good" but they IMO don't prove that K programmers are superior beings who reached enlightenment - they prove the exact opposite, lack of understanding the rest of the world. It's fine to say "I'm quirky and it's fine, this makes me special". It's wrong to say "The rest of the world is quirky, they don't share my niche preferences".

Re: Stages of denial in encountering K

#168
post #96

Earlier quoted context omitted.

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

Javascript must've done _something_ right, no? Yes I know it's bad from "language design" perspective, but we all know what it did right: it was embedded out-of-the-box on a very popular platform (the browser). So, there is an explanation. 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 nich…

Why is it strange? Think of languages like Lisp, Smalltalk, Haskell. You may not find them on top of TIOBE, but their innovations do trickle down to mainstream, indicating that the designers of mainstream languages find them worthwhile.

Array languages are very much poised to do the same, if they did not already: numpy is essentially a poor (and verbose) man's array language embedded in python. Or consider Matlab.

Re: Stages of denial in encountering K

#169

Earlier 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…

> explicitly update callers to use the new version

In a genuinely write-only language, how do you update those callers? You can't, you'd have to write new ones to call your new bugfixed function. And then you'd have to write new callers of those callers...

You'd have to rewrite the whole program every time you wanted to make a change. Which would make bug-fixing a much more cerebral activity since you'd want to work out as many as possible before the rewrite to save time.

Re: Stages of denial in encountering K

#170

Earlier quoted context omitted.

Javascript must've done _something_ right, no? Yes I know it's bad from "language design" perspective, but we all know what it did right: it was embedded out-of-the-box on a very popular platform (the browser). So, there is an explanation. 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 nich…

Why is it strange? Think of languages like Lisp, Smalltalk, Haskell. You may not find them on top of TIOBE, but their innovations do trickle down to mainstream, indicating that the designers of mainstream languages find them worthwhile. Array languages are very much poised to do the same, if they did not already: numpy is essentially a poor (and verbose) man's array language embedded in python. Or consider Matlab.

> "A LISP programmer knows the value of everything and the cost of nothing."

Here, a very old quote that tells you directly what is wrong with FP - the performance on old hardware sucked. For a very long while compilers/interpreters were not good enough.

The cost/benefit equation changed in recent years, and sure enough, FP ideas are becoming mainstream.

Again, I'm not saying that array languages don't have fundamentally great ideas. I'm saying that articles like this one do them no favor - they're just smug rants. Show the world you understand the downsides, and you get a better chance of promoting the upsides.

Post reply on HN