Live data from Hacker News

Stages of denial in encountering K

nsl.com

131–140 of 432 posts

Re: Stages of denial in encountering K

#131

The irony of claiming to represent a readable language, that others are in denial of reality about this, and presenting your thesis on a '90s looking website with typographic lines spanning almost 400 chars at 100% width... ABTASTTSBMR than the whole sentence. OK.

I very much liked the design. Perhaps I'd slap a max-width on it, but other that that it was a delight to read. (And my browser's reader mode really liked it, too.)

Re: Stages of denial in encountering K

#132

Earlier quoted context omitted.

The readme examples remind me of Perl code. Example: print !~($/=$")+2*map 1..$s{$_%$'}++,

This one comment managed to insult both K and Perl coders...

I don't think Perl coders need any help with that.

Re: Stages of denial in encountering K

#133
post #125
post #107

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

Only if it's written in a style which affords reading. K programmers seem to want to write their code in a mathematical style, but without the natural language prose which makes mathematical papers readable. In a paper by a mature mathematician, the equations only perform some of the work in expressing the idea. The rest of the work is done by prose written with an intent to be lucidly expository, to allow the notati…

>We have this style in the programming world. It's called Literate Programming. How many K programmers write in that style?

More than you would think. I had a very nice gig at a hft years ago where we were using noweb+k extensively.

The only place were I edited source code by hand with paper, pen and paste.

Re: Stages of denial in encountering K

#134
post #65

Earlier quoted context omitted.

> “sum” word has very few meanings, especially in software engineering world Sum types, checksums, …

That’s why I said “few”, not “one”?

I'm not sure that sum and product differ significantly, which is why I brought up a couple of examples.

Re: Stages of denial in encountering K

#135
post #127
post #95

Earlier quoted context omitted.

A bit more convincing: http://www.kparc.com/edit.k Properly formatted and with comments, it almost looks readable. The insistence to use one- or two-letter identifiers that you then have to look up the meaning of in a comment makes it look pretty childish, though. "Look ma, it's still super terse even when doing something real!" Yes kid, it is when you refuse to do the one obvious thing that could actually make it re…

Single-letter identifiers are a natural thing to object to when coming from other language paradigms, i.e. nearly every programming background out there, but this is a category error. What seems ridiculous in one context can be sensible in another. The objection turns out to be parochial. It reminds me of how people think that parentheses are a significant aspect of Lisp, when in practice they're not. The parens look…

Are APL programs normally clumped together, as they are commonly presented to show off their terseness, or do they normally have comments and line breaks to indicate structure?

Re: Stages of denial in encountering K

#136
post #107

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

I doubt that K can reduce line count by a factor 1000 though. The examples in the article is mostly about shorter identifiers like "!" instead of "range" and a compact notation. That is perhaps a factor 5 not a factor 1000.

The example with a for-loop for summing a range is a blatant strawman. In which modern language would that be idiomatic?

Furthermore the examples only show a particular use case: Processing lists of numbers. How does the benefits measure up for all the other stuff a million-line program does?

That said, if you really have a million-line program doing mostly numerical processing, then I'm sure it would be a massive benefit to switch to a programming language optimized for this task.

Re: Stages of denial in encountering K

#137
post #107

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

I assume you enjoy reading gzipped versions of documents, from binary.

Re: Stages of denial in encountering K

#139
Look, I don't hate K. It's probably a pretty good language for the task it seems to have been designed for, which appears to be numerical computing. Being able to fit an entire code on a screen is an interesting concept; while I'm not completely convinced it should be a goal in and of itself it's certainly something I can't rule out as a possible productivity booster.

However, I still find it problematic, and it's not really about the language itself: it's more about how it's promoted in the article, by the people in this thread, and in general. Specifically, the claims it's perfectly readable, and anyone who says anything otherwise is either stupid, lying, or too poor to understand it are not useful. (Yes, you know who you are for that last one. You're not helping your case.) The fact of the matter is that most programmers are used to ALGOL-esque syntax, and there is significant value in being able to lift concepts and interoperate between those languages at a superficial level. Every "inspired" languages hits these issues, depending on how "strange" it is: Objective-C is ugly, Lisp is alien, and on the far end APL derivatives are simply labelled as unreadable. That doesn't mean they're bad languages, but to those promoting it: drop the attitude, and understand why we have reservations. Your language isn't the "true" way to program, that only the chosen elect can understand and lecture us on. Don't ignore or gloss over languages that have similar features to yours. We want to hear what the interesting things are that you can do in the language, actual guidance for how we can adapt to the language (not: "one-letter identifiers are just what we do; deal with it"). Thanks.

Re: Stages of denial in encountering K

#140
what is `the closest i got to finding some pattern is this:

  >>> xs
  '34210'
  >>> grade(xs)
  [4, 3, 2, 0, 1]
  >>> grade(grade(xs))
  [3, 4, 2, 1, 0] # :O
where

  grade = lambda xs: (
     [i for (i,_) in sorted(enumerate(xs), key=swap)]
  )
  swap = lambda p: (p[1], p[0])
no clue what it means though.

(i guess "ordinal" really is too ambiguous...)

EDIT

alright, i see it now - `<<xs` is "for each item x of xs, where does x land when you sort xs?

Post reply on HN