4 ms·
> The same baseless accusations of “unreadable”, “write-only” and “impossible to learn” are leveled at all Iversonian languages, k included. I'd be really curi
by IshKebab 2y ago
> The same baseless accusations of “unreadable”, “write-only” and “impossible to learn” are leveled at all Iversonian languages, k included.
I'd be really curious to know if they really are baseless. It's very very difficult to imagine that K developers can really read a mess like this as easily as one might read Go or whatever.
https://github.com/KxSystems/kdb/blob/master/e/json.k https://github.com/KxSystems/kdb/blob/master/e/json.k
Has anyone tested this? Take a K program and ask a K developer to explain it? Or maybe introduce a deliberate bug and see how long they take to fix it compared to other languages. You could normalise the results based on how long it takes them to write some other code.
Free research project for any compsci researchers out there... (though good luck finding skilled K programmers).
- geocar 2y ago> It's very very difficult to imagine that K developers can really read a mess like this as easily as one might read Go or whatever. 水落石出。 > Has anyone tested this? Take a K program and ask a K developer to explain it? I am not sure what you're asking. Do you want me to read it to you? Here is me reading some other people's code: https://news.ycombinator.com/item?id=8476633 https://news.ycombinator.com/item?id=8476633 https://news.ycombinator.com/item?id=22010223 https://news.ycombinator.com/item?id=22010223 Do you want me to read to you the JSON encoder (written twice) and the decoder in this way? > Or maybe introduce a deliberate bug and see how long they take to fix it compared to other languages. https://news.ycombinator.com/item?id=27209093#27223086 https://news.ycombinator.com/item?id=27209093#27223086 > You could normalise the results based on how long it takes them to write some other code. https://news.ycombinator.com/item?id=22459661#22467866 https://news.ycombinator.com/item?id=22459661#22467866 https://news.ycombinator.com/item?id=31361023#31364262 https://news.ycombinator.com/item?id=31361023#31364262
- IshKebab 2y agoThanks that was very interesting. It seems to me that it has a lot of the same properties as regex. Looks like gobbledygook at first glance, but after learning it I can write them, and read them with some effort (depending on the complexity). However nobody would describe regexes as "readable", and they're quite error-prone. I definitely wouldn't want to write a whole program in regex. Regexes shine most when they're used interactively, e.g. in one-off greps, or editors. There readability doesn't matter at all, error-proneness doesn't really matter, and terseness is important. The problems start when people put those grep commands in scripts where the output isn't supervised by humans. I wonder if the same is true for K - it started as a query language for one-off queries & investigations, and then people started saving those queries and making bigger programs?
- geocar 2y ago> However nobody would describe regexes as "readable" I would, and do, and I urge you to be less judgemental about things you do not know anything about because you will never learn anything new with that attitude. > I wonder if the same is true for K - it started as a query language for one-off queries & investigations, Why do you wonder this? I don't think it's true, but so what? Did you not read what I wrote? Seriously: Why do you put so much effort trying to talk yourself out of learning how to do something that is obviously amazing to you? I am telling you I can read this. I like this. I am not nobody, just someone you did not think existed. And I am telling you it is possible for you too.
- IshKebab 2y ago> I would, and do, and I urge you to be less judgemental about things you do not know anything about because you will never learn anything new with that attitude. The thing is, I am extremely familiar with regexes (I've even written a regex engine), so I know exactly how readable they are - even after knowing them really well. So the fact that you think they are still readable suggests to me that your judgement of K's readability is also suspect. > Why do you wonder this? It would be a reasonable explanation of why K exists.
- geocar 2y ago> The thing is, I am extremely familiar with regexes (I've even written a regex engine), so I know exactly how readable they are - even after knowing them really well. Your experience writing a "regex engine" once upon a time led you to believe regular expressions are difficult to read. My experience maintaining a few million lines of perl over a couple of decades has led me to believe that I can read regular expressions with no discomfort. The Real™ thing is you can get better at anything with practice, even this, but listen I also think K is more useful than regular expressions and I would have used less perl had I learned K sooner. > So the fact that you think they are still readable suggests to me that your judgement of K's readability is also suspect. It should make you suspect whether or not you have any idea what an expert actually is. I mean, the inventor of regular expressions tinkered with them for decades, and new advancements are still happening sixty years later! You don't know what you don't know, and there is very little you can do about that except pay attention to people who can do things you do not know how to do yet, and reserve your judgement about how they do it until you can do it better. The only thing k has in common with regular expressions is your claim they are both difficult, a claim I disagree with. > > Why do you wonder this? > It would be a reasonable explanation of why K exists. You misunderstand me, perhaps on purpose, but I hope you and others will think about this: Why do you care why it exists when I have shown you something so much more amazing than an opinionated history lesson? I think k exists to make programs that make money. Forever. Because a little bit of money from a lot of programs over a long time is worth a lot, k is fast to write it. Because sometimes getting the answer faster makes more money, k runs fast too. Because people are trusting their money with it, k runs very predictably. Because sometimes your vendor just changes the input format on a Friday night, it's important that it is easy to read and make changes to k programs. Arthur said it was the keys to the kingdom.
- michaelg7x 2y agoIt's entirely possible, have done it at few times. For example, the `fby` verb[?] annoyed me one too many times, so I pulled it apart to see what was going on. In contrast to json.k it's quite short. I usually split each separable idea into a new line and introduce a bunch of new variables to track state that would otherwise be passed from right to left. Lengthy end-of-line comments are my chosen way of understanding q or k when I come back to anything later.
- jbritton 2y agocode_report does a bunch of videos on this https://youtu.be/pq1k5USZZ9A?si=hmzucWWdNnGrI0Os https://youtu.be/pq1k5USZZ9A?si=hmzucWWdNnGrI0Os
- jbritton 2y agoLink to the video before the one above that compares APL, BQN, J, R, Julia, Numpy on the same problem. https://youtu.be/8ynsN4nJxzU?si=EeAZEZzA2kd0mw1y https://youtu.be/8ynsN4nJxzU?si=EeAZEZzA2kd0mw1y
- rak1507 2y agoYou have been talking about array languages on HN for at least 6 years, and still refuse to believe that anyone can read them! What do you have to gain from this stance, and why don't you believe people who tell you otherwise?
- IshKebab 2y agoIt's not a question of can they read them, it's are they readable. I obviously don't believe things just because people say them. Do you?
- rak1507 2y agoWhen it comes to subjective opinions, what other choice do you have? Your idea of doing studies is interesting but that's not even been done for most languages, yet claiming "python is unreadable" would clearly be laughable. Either everyone who uses array languages does actually find them readable, or they're all persistently lying for... what reason? And forcing themselves to use something they don't find readable? Why would anyone do that! Especially considering a lot of array language users are hobbyists, who have chosen to use them, it's not like they're forced to.