Live data from Hacker News

Stages of denial in encountering K

nsl.com

321–330 of 432 posts

Re: Stages of denial in encountering K

#321
post #284

Earlier quoted context omitted.

And 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 li…

> kdb isn't written in an external language. But it's an external database with its code and its optimizations. In this case it seemed that it was just doing a binary search, but it was using an already sorted dataset that the OP of that comment wasn't using. > kparc.com/$/ Well, I can't get anything out of this. See http://kparc.com/$/file.k . The language is cryptic and the variable names are even more cryptic. It'…

But it's an external database with its code and its optimizations. In this case it seemed that it was just doing a binary search, but it was using an already sorted dataset that the OP of that comment wasn't using.

I again point to the C standard library. Modern standard-compliant C can do almost nothing without it. I don't even think it can handle IO without it.

The language is cryptic and the variable names are even more cryptic.

You're thinking of it in a light that doesn't help you understand; don't think of it as a variable, think of it as a definition. "jk is defined as..."

Re: Stages of denial in encountering K

#322
post #270
post #19

Earlier quoted context omitted.

I'm very much a believer in concise notation (more than most people I've worked with), but the advantages of having a name that can be unambiguously spoken are large enough to outweigh a small constant factor. I don't believe this holds up to scrutiny. APL as a language was made to be spoken, and it seems to have succeeded in that. Alan Perlis briefly touched on that in a great paper,[1] and just about everyone who's…

> I don't believe this holds up to scrutiny. APL as a language was made to be spoken, and it seems to have succeeded in that. Alan Perlis briefly touched on that in a great paper,[1] and just about everyone who's worked with the language and its derivatives agrees that your statement isn't true. The people who have worked with the language are a small and highly specialised minority of programmers, unusual in many re…

Alan Perlis is a Turing Award-winner who helped to standardize the most influential language of all time, ALGOL, of which Go, Python, C and most languages originate. In many respects, he was closer to a Go programmer than a Haskell programmer.

Haskell's symbols aren't notation, they're just scribbles. Miranda is a better comparison, but Miranda too doesn't lean hard enough.

Ken Iverson literally developed APL as a way to give better lectures at Harvard. It was a verbal and handwritten language long before it was typed. It excels at it, because it was designed for it.

Re: Stages of denial in encountering K

#323

Earlier quoted context omitted.

> Overly-concise code being difficult to maintain is a well-accepted fact. Many seasoned APL/J/K programmers state that conciseness is an asset. I would trust their judgment on that. There are ways in which that and the quoted statement could both be true at the same time.

Aaron Hsu writes about this a lot. In an APL snippet, you often don't need layers of blackbox abstractions. You can see the whole thing at a macro layer. I'm sure it takes time though.

Mathematics is also written tersely but not this tersely, and nor is terse math easy to read for mathematicians.

Terse logic is also very different from terse names; how much of K brevity is just from name compression vs logical succinctness? Haskell people could also use single character names everywhere. When will they adopt the conveniences of fitting everything in as few pages as possible?

And what’s the point of fitting as much content as you can into one eyeball when working memory can’t consume a whole page of a non-succinct language like Python?

Re: Stages of denial in encountering K

#324
post #279

Earlier quoted context omitted.

> 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). > U…

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

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

Re: Stages of denial in encountering K

#325

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

For regex, named capture groups can also be used so one group per line isn't as required:

    $_ =~ m/^                                     # anchor at beginning of line
            The\ quick\ (?\w+)\ fox    # fox adjective
            \ (?\w+)\ over                  # fox action verb
            ...

Re: Stages of denial in encountering K

#326
post #315

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

> Where are the comments? While I can understand how that code can be intimidating to a programmer with a more “traditional” background… there are 26 (non-empty) lines of comments, and only 15 lines of code.

10 of those 26 are "exercise", not comment. The 6 lines above that are ununderstandable, and I can only find two others, which fail to explain what it's supposed to do.

In this context, "intimidating" and "less tradational" are euphemisms that stem from cognitive dissonance reduction.

Re: Stages of denial in encountering K

#327

Earlier quoted context omitted.

You're overestimating how readable any programming language is to non-programmers.

With decent identifiers you can kind of guess the purpose of things without understanding anything else about it. A file with words such as "latitude" and "coordinate" and "distance" in it is probably something to do with maps, for example.

Non-programmers making sense of code in this way is extremely rare. I don't think this is a priority in programming language design, the same way that making dashboards accessible to non-pilots is not a priority in airplane design. That would certainly be a poor reason to sacrifice major improvements in airplane efficiency or safety. Designing simpler dashboards for student pilots as a learning device is of course a different matter.

Re: Stages of denial in encountering K

#328

Earlier quoted context omitted.

With decent identifiers you can kind of guess the purpose of things without understanding anything else about it. A file with words such as "latitude" and "coordinate" and "distance" in it is probably something to do with maps, for example.

Non-programmers making sense of code in this way is extremely rare. I don't think this is a priority in programming language design, the same way that making dashboards accessible to non-pilots is not a priority in airplane design. That would certainly be a poor reason to sacrifice major improvements in airplane efficiency or safety. Designing simpler dashboards for student pilots as a learning device is of course a…

[deleted]

Re: Stages of denial in encountering K

#329
post #279

Earlier quoted context omitted.

> 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). > U…

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

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

There are a few of us in this thread, trying to explain why.

You find outrageous that 2&3=2, almost everyone (all the non-programmers of the world) will find more outrageous that i=i+1. You get used to it quite fast. It's obvious as soon as you realize that, with booleans, min is and, and max is or.

Re: Stages of denial in encountering K

#330

> When the entire system fits in a page of code you can understand everything about it from the top down. I'm sorry, but that sounds like the juvenile fantasy of someone who is still in their programming puberty. Good luck fitting an operating system, web browser or air traffic control system into a page of code.

Please don't descend into name-calling.

What PeCaN said there is no different from what masters like Chuck Moore and Arthur Whitney say. Maybe you disagree, maybe not everyone is like those guys, but "juvenile fantasy" and "programming puberty" is an extremely shallow dismissal—which https://news.ycombinator.com/newsguidelines.html specifically ask you to avoid.

We detached this subthread from https://news.ycombinator.com/item?id=22523047.

Post reply on HN