Earlier quoted context omitted.
The "amount" of code is the same as in any functional language though. It's just written in a smaller text file.
Arthur tries to choose primitives carefully so that the amount of steps is smaller than other languages (see the 'product' quote in another comment). So even if you give each symbol an English name, the code will often end up smaller.
Stages of denial in encountering K
291–300 of 432 posts
Re: Stages of denial in encountering K
#292Earlier quoted context omitted.
Thus the source code is essentially compressed code and, as we know, compression makes thing more random hence more noise-like. This is wrong. k programs aren't really random at all. It's not even that complicated; it has less than thirty primitives. It's a notation for representing ideas, and it excels at that. Dyalog APL is similarly terse, although less so, and the goal of it isn't to be terse. This criticism stil…
> This is wrong. k programs aren't really random at all. The k source code posted around here are certainly more random than a similar byte count of say Java code. Try zipping 1000 bytes of either. > notation isn't golfing, it's a convenient way to express thought Sure. But up to a point. And it seems to go beyond pure notation. Check out the interpreter posted here: https://bitbucket.org/ngn/k/ It _requires_ a readm…
For example: https://news.ycombinator.com/item?id=22009876
How would a new user know what this did without checking the definition?
Why would somebody want to know what it does without checking the definition? The definition isn't complex, and the program can be read and kept in your head in the span of a minute. It's also well-commented.
Re: Stages of denial in encountering K
#293Earlier quoted context omitted.
https://www.gnu.org/software/apl/ Most likely available through your package manager.
Better: Free software K interpreter: https://bitbucket.org/ngn/k/ Arthur's K interpreter isn't actually that expensive for casual use anymore (it's free for most non-commercial use and you can download it off the Shakti website pretty easily), though. Not that I'd recommend it: Arthur's a genius, but nothing's worth using proprietary software for. What I usually recommend for learning the paradigm is J, largely becau…
Re: Stages of denial in encountering K
#294Earlier quoted context omitted.
I'd rather read 30 lines of Java (yes Java !) than try to decipher one line of K !
Matter of taste; I cannot imagine having to program Java (give me Clojure/Scala any time if jvm is required) for a living anymore; deciphering a lovely 200000 class codebase where every call in every 30 lines bring you into a deep spelunking trying to figure out where/how/what and hoping it's not in some ancient undocumented .jar etc. So I have very much the opposite of what you have. Then again, I have been doing k/…
I assume you are comparing this to deciphering and maintaining K-code written by developers who uses all the idioms just a bit wrong?
Re: Stages of denial in encountering K
#295I love the brevity of regular expressions and use them on a daily basis. It is the same argument that keeps me returning to K: the syntax is terse and compact, the semantics are simple and composable, and your eyes get used to it. Beyond a point however, I cannot read my own regex's after a month's absence. Which is why I use perl's /x modifier extensively to split up regex components onto multiple lines and to docum…
> https://a.kx.com/a/k/examples/xml.k > Where's the pedagogy? Where are the comments? Most of that document _is_ comments. There's a comment on almost every line, very similar to your perl example. Comments begin with a "/" character which doesn't have a function to the left (e.g. whitespace). First we have some constants (L,W,B,S,R) which refer to the left-bracket, whitespace (which includes blank), blank space, and…
Re: Stages of denial in encountering K
#296Earlier quoted context omitted.
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.
I suspect everyone would love K if they had an extra 30 IQ points to work with. 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 usu…
The real issue is knowing your userbase.
Example: we have this in-house DSL that's been around for years and uses a symbolic representation not a million miles from K that we use for automating reports. The problem is it's a pain to onboard people who, whilst they're bright enough, aren't programmers and in any case have many other responsibilities to attend to. Giving them something more readable rather than arcane makes life easier for everyone.
And fundamentally we want to make it easy for everyone, not just the top quartile or the top 10%, to quickly crank out high quality automated reports across different market sectors, geos, etc., as well as to modify and maintain these reports into the future.
Re: Stages of denial in encountering K
#297Earlier quoted context omitted.
My CS program (class of 2007) was mostly c++. There was one semester of Java, but it was optional. We learned fundamentals, discrete math, symbolic logic, and also "databases" (read: MS Access), object-oriented design, and I forget what else. With the benefit of hindsight, I feel like I overpaid for that education :)
I’m a math student minoring in CS and I covered all of that before I’d finished second year. I also covered functional programming in first year. I’m really surprised your CS degree didn’t cover operating systems, compilers, or algorithms. CS students at my school are required to take all of that stuff (and a lot more, including everything you’ve mentioned) before they even finish 3rd year. In 4th year they’ll be stu…
Like I said, I feel that I overpaid for that education. The degree itself has paid for itself many times over, but I needed to learn basically everything important for a CS career on my own.
Re: Stages of denial in encountering K
#298A 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.
Especially so if you don't count library code, and I don't because otherwise you end up doing things like counting the number of lines of code that back the Win32 APIs in your program line count, which doesn't seem sensible. Most of the time we treat libraries as black boxes, except on rare occasions, so don't tend to think of them as part of "our" codebase[1].
Most million line plus systems are broken down into subsystems (applications, services, libraries, etc.) that in isolation are smaller, and in many cases much smaller.
Even with those rare million line of code monoliths, for the most part there's some level of organisation in the codebase: layers, subsystems, components, or a mixture of these and whatever else is appropriate.
This organisation, and particularly when coupled with modern tooling, facilitates the understanding of even very large systems.
I don't say that it's necessarily easy but, then again, neither is understanding a large, complex system implemented in K.
[1] Except when thinking about security because third party code has been shown to be a rich source of vulnerabilities.
Re: Stages of denial in encountering K
#299Earlier quoted context omitted.
This 100 or 1000x claim is extraordinary. Do you have any factual basis for repeatedly asserting it?
Contrived Debian shootout benchmarks: http://www.kparc.com/z/comp.k https://web.archive.org/web/http://shootout.alioth.debian.or... Note that the relevant k program here is contained entirely on the last line of code and denoted by a comment telling you what it does: http://www.kparc.com/z/fun.k http://c2.com/cgi-bin/wiki?WardNumberInManyProgrammingLangua... Most Joy people are also k people, and Joy appears to be th…
The Scheme and Haskell versions are actually shorter than you imply since they include the pairings in the count (when the pairings in the code are examples). Additionally, the k version is one line longer than you suggest. The definition of a is on its own line is used in the solution. Still only 2 lines, but if you want to persuade you should probably have correct numbers.
Re: Stages of denial in encountering K
#300Earlier quoted context omitted.
> Then it's not perfectly readable. That, or your definition of readable is useless because then any programming language is readable given enough study time. Given a fragment of Chinese, if you do not know Chinese, would you say it is unreadable? What possible definition of "unreadable" could you have that would make that a useful statement? No, I don't think speaking to a language as being "unreadable" is particula…
Sorry to start popping up on all of your threads! Your points are really good here, and writing code that runs faster and finding a solution yourself faster are clear wins for a language. I think the value of those wins is subjective, though. If you need speed of execution, or if you're working in a green-field scenario and need to get your work done super fast, your wins are the most valuable ones. But for example,…
Kdb+ is fully integrated K and a K-like query language running on an SSD array database built for array languages and stock/banking usage. Can you write a web app in it? Sure, but I doubt very many do and those that do probably just use K as the numerical engine and JS for everything else.