4 ms·
The comparison with languages as Chinese is not very appropriate because everybody has a native language. In that sense, programmers have more of a 'tabula rasa
by gjulianm 7y ago
The comparison with languages as Chinese is not very appropriate because everybody has a native language. In that sense, programmers have more of a 'tabula rasa' (not completely, of course) that makes for more appropriate comparisons of readability. Usually, when people talk about "readable programming languages" the definition is taken as the amount of effort an average programmer needs to read a certain "standard" piece of code. You can of course categorize (readability of mathematical programs, or of system interactions?) and specify (for general programmers? for data scientists? for functional programmers?) but overall that's it.
Regarding your examples:
1. If you are using a database then it's not an argument for the language, I think.
3. A binary search is hardly a selling point of a language.
4. Views are cool, I reckon that. Although K is not unique in that regard.
5. That solution is, from my point of view, suboptimal and non-obvious. It's not only harder to understand than the naive search but it also performs algorithmically worse in all situations: it always performs nm comparisons (n, m being string, substring lengths resp.) plus the hidden cost of the rotation (which could be zero, could be not-zero depending on how is that implemented) plus the AND of every bit, plus the search of the match position.
I also left the second one as the last, because that, to me, is an anti-example. See the things I need to have "in-memory" in order to understand the snippet `Paper`Rock`Scissors@&/"ki"?
"ki"? means search for "k" or for "i"? I have to assume it's what that is, but I can't reconcile that with the documentation of the find function https://code.kx.com/q/ref/find/ https://code.kx.com/q/ref/find/ because I don't know where comes the function argument.
* / means 'over'. Together with '&' (which somehow is both 'and' and less than? that's very confusing) it looks like it takes the minimum? I honestly do not know what it's meant to do at this point because I don't know what kind of object is "ki"?.
* @ means 'apply' and here I don't get how you are applying three actions to a what, a list? Because I get that ` means 'print'. Knowing what the code does I assume that when it finds 'k' (index 0) does the first action (paper) and so on. Looks like the 'find' function returns the length of the list when an element is not found (weird, because it is a very good way to facilitate mistakes and induce race conditions) so that's how you get 'scissors' in the other cases.
To me it's weird that you put this as an example. A code example that, despite being pretty simple (if the input has k, return Paper, if it has i, return Rock, else return Scissors) I am not able to understand it even with the documentation at hand. Given this example, I find hard to believe that you can find any K code and understand it quicker that you'd do with other programming languages. And I honestly doubt that it's faster than a for-loop in C.
Yeah, you can say you understand it. But you need a bigger "translation table" than in other languages, which adds to the mental concepts that you also need to keep in mind with programming. It's not to say that it's impossible, but it's more mental work for, as far as I have seen, very little benefit. It can work better for you, yes, but it's very possible that it's just that you're used to it and you don't notice the extra burden of dealing with that code.
- kick 7y ago1. If you are using a database then it's not an argument for the language, I think. The database is a piece of the language, though, and the language ships with it. Python has a lot of very complex things in its standard library; C without a standard library is foreign to most programmers. Why do they get a pass while k doesn't? It can work better for you, yes, but it's very possible that it's just that you're used to it and you don't notice the extra burden of dealing with that code. It's not like 'geocar is foreign to writing in other languages. His GitHub (github.com/geocar) is full of projects in other languages, some fairly recent. This may make sense as an accusation for someone who doesn't write any other code, but I don't think it's a fair accusation here. If there was some intense burden from writing k in comparison to ALGOL-like languages, would 'geocar have written an operating system in it rather than C? That doesn't seem apparent to me.
- gjulianm 7y ago> Why do they get a pass while k doesn't? When we are discussing languages, they don't get a pass. Python has a great math library with Numpy, but it doesn't mean that the language itself is optimal for math-related problems. And specifically in that example, using an external database when defending the speed of the language... meh. It's as if I said that Python is very fast and showed a Numpy calculation. > This may make sense as an accusation for someone who doesn't write any other code, but I don't think it's a fair accusation here. It's not about writing or not other languages. It's about being so used to something that you don't notice the burden. I am very familiar with some of the projects and languages I work in and I feel comfortable with the codebase, and I get used to the mental burden of working with them and I end up not noticing it. It doesn't mean it is not there. > would 'geocar have written an operating system in it rather than C? Has he? Couldn't find anything (I'd like to see it, honestly, seems a fun experiment).
- kick 7y agoAnd specifically in that example, using an external database when defending the speed of the language kdb isn't written in an external language. Has he? Couldn't find anything (I'd like to see it, honestly, seems a fun experiment). Not entirely him, of course. There are a few remaining files on kparc.com: kparc.com/z/ kparc.com/$/ so on. Not free software, and they seem reluctant to show it off. 'geocar has done a live demo of a primitive version, though: https://www.youtube.com/watch?v=kTrOg19gzP4 https://www.youtube.com/watch?v=kTrOg19gzP4 (2014) The archive is more interesting: https://web.archive.org/web/20130830071750/http://kparc.com:80/ https://web.archive.org/web/20130830071750/http://kparc.com:...