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 ra
by geocar 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.
How do you figure? Programmers too, have a "native language" (usually the one they use the most, or that has the most powerful features they know how to implement).
> 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.
I think that's a load of shit. What would be the point of communicating such an opinion to others?
> 1. If you are using a database then it's not an argument for the language, I think.
It's built-in to the language. You don't call Python a database because it can unpickle things.
> 4. Views are cool, I reckon that. Although K is not unique in that regard.
Excel has views. I'm not aware of any other language that has them. Do you have some examples?
> 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.
See the first example under type-specific uses of find. x (the left argument as given in the example) is a simple list.
> / means 'over'. Together with '&' (which somehow is both 'and' and less than? that's very confusing)
https://code.kx.com/q/ref/accumulators/#unary-application https://code.kx.com/q/ref/accumulators/#unary-application
https://code.kx.com/q/ref/lesser/ https://code.kx.com/q/ref/lesser/
To x&y is the lesser of x and y. You can see in binary this harmonises with logical and:
00001110b&11110111b
00000110b
> I get that ` means 'print'.
No. `foo is a symbol foo. A symbol by itself is an atom, but `a`list`of`symbols can be written just by writing them together.
https://code.kx.com/q/basics/datatypes/#symbols https://code.kx.com/q/basics/datatypes/#symbols
> 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.
Actually the point is to look at the analysis to see how I chose k and i. If you already know you can solve the game by searching for "k" and "i" then you've missed the point: Array programming languages make this obvious.
- gjulianm 7y ago> How do you figure? Programmers too, have a "native language" Unless everybody is born learning a language, no we don't. Even 'The one they use the most' varies over time. > What would be the point of communicating such an opinion to others? An easy use case: you're in your company and you need to do a simple script for some computation. The more readable the language you use is, the more coworkers will be able to find a bug/reuse it/modify it without requiring your help. > It's built-in to the language. You don't call Python a database because it can unpickle things. I read more of the parent comments on that link. I didn't notice that the OP started with an unsorted dataset, you did binary search on a sorted one. I thought that it the "kdb native format" meant more database magic that just serialization. > Excel has views. I'm not aware of any other language that has them. Do you have some examples? --C++ has string_view at least. I think C# had also views of some sort but whenever I search 'C# list/string view' I get MVC or WPF examples about unrelated things.-- Misunderstood what a view was, IDK why I thought it was string/list views. > To x&y is the lesser of x and y. You can see in binary this harmonises with logical "harmonises" in the sense that it takes one of the most common programming symbols and changes it? I don't know of anyone that sees "2 & 3 = 2" and thinks "yeah this makes sense". > Array programming languages make this obvious. How? First, your analysis line is even more cryptic than the resulting code. And I don't think the idea "find the minimum distinguishing characteristics between the outputs" can only be born out of array programming languages. Don't get me wrong, I think it's smart, but I don't see how the language makes that obvious. Edit: Sorry, I misunderstood what a view was.
- geocar 7y ago> Unless everybody is born learning a language, no we don't. Even 'The one they use the most' varies over time. Nobody is born having learned a language. It's something even babies have to learn and they know nothing! People can even "switch" their native spoken language up to a point although it seems to get much harder as they get older and more experienced with one language, as they're constantly comparing their aptitude to their "native" one -- just as they do with programming. > An easy use case: you're in your company and you need to do a simple script for some computation. The more readable the language you use is, the more coworkers will be able to find a bug/reuse it/modify it without requiring your help. The decision to bring another language into a company requires different considerations for every company. The one I work for has a lot of q/k programmers, so this isn't a problem for me. I like programming in k, so it makes sense I might want to be around other k programmers. I think if you decided to write your "simple script" in even a well-known language like JavaScript, you'd cause some grumbles in a Python+C# shop; k isn't special in this regard. > I read more of the parent comments on that link. I didn't notice that the OP started with an unsorted dataset, you did binary search on a sorted one. HIBP offers the data pre-sorted, so I used that. I could have used asc (actually sort) instead of `s# (an assertion that it is already sorted) if I'd used a different file, but I value my time. > I thought that it the "kdb native format" meant more database magic that just serialization. No. It's literally just mmap. There's a header on the file describing the array shape, and indicating that it is sorted (so bin will be accelerated), but that's it. kdb is a database in exactly the same way that Python could be if you just pickle/unpickle everything, except it's actually fast enough that people do this, even for large data sets. > "harmonises" in the sense that it takes one of the most common programming symbols and changes it? I don't know of anyone that sees "2 & 3 = 2" and thinks "yeah this makes sense". If you write something like (f=42)&(g=69) you expect "&" to mean "and" here, right? Well if f is an atom, then f=42 returns either a 0b or a 1b based on whether f is 42. What if f is a vector? Well, let's see: f:1 42 2 g:4 69 4 f=42 returns 010b and g=69 returns 010b -- do you see why? Now 010b & 010b should return 010b for the same reason that 1b & 1b should return 1b (and 1b&0b should return 0b). "&" is just generalised from here to work the same way non-binary values. Having it convert to binary-and would be very confusing for vectors, and although I can see a consistent way it could work, I don't see the value in that operation.