News for hackers. Stuff that matters.
Re:ngn/k, an AGPL K interpreter by OskarS on Friday January 10, 2020 @03:50AM (#22009473)
Is K [0] in some sort of competition with J [1] about who can write worst, most unreadable and unmaintainable C code possible?

[0]: https://bitbucket.org/ngn/k/src/master/m.c

[1]: https://github.com/jsoftware/jsource/blob/master/jsrc/v2.c

Re:ngn/k, an AGPL K interpreter by kick on Friday January 10, 2020 @04:50AM (#22009771)
Snide remarks are dull, and HN's guidelines explicitly recommend against cheap humor. Every time K is posted to HN someone makes this exact style of comment in an attempt to be funny, but it's entirely unoriginal.

There's good reason as to why C written by APL programmers looks as it does, and shallowly dismissing it does a disservice to everyone.

Re:ngn/k, an AGPL K interpreter by msla on Friday January 10, 2020 @12:42PM (#22012858)
I still wonder if this is the form the author of the code uses to write the program.
Re:ngn/k, an AGPL K interpreter by atemerev on Friday January 10, 2020 @03:57AM (#22009496)
There are people who value brevity and minimal amount of code above everything else. Arthur Whitney, the author of K, doesn't even use scrolling — everything he reads or writes has to fit on a single page.
Re:ngn/k, an AGPL K interpreter by tgv on Friday January 10, 2020 @08:20AM (#22010714)
Brevity should not be an excuse for obscurity and illegibility. I get it that you assign a short name to central data structures, but all those two character identifiers...
Re:ngn/k, an AGPL K interpreter by tluyben2 on Friday January 10, 2020 @09:33AM (#22011147)
As this thread and post proves, quite a lot of people have no issue reading + understanding it. One of the goals to fit a lot of functionality on 1 screen which helps, especially when you get older, but it always helped. No scrolling, searching, trying to find in which abstraction in which of the 1000s of files with 'readable' code things are stored. You open 1 file and yes it will take you (a lot) more time to read the same length (in lines) page of, let's say Java or C#, but in those languages you will need often 10s, 100s or even 1000s of these pages (in many different files because that's 'readable') to write the same functionality idiomatically in that language as that one pager in this style. So people who take the patience to read and understand this will actually be more productive in my experience: I am claiming that it will take most people (a lot) more time to read and understand this code if it was written in a traditional way in C or whatever, with proper variable names, spread over many nicely created .h and .c files than it takes someone who has done this before to understand and work on this. And that gets more obvious when you actually start using APL/K/J which allow even more expressiveness into the language and will let you even compress more functionality in less characters.

However it does not naturally scale to teams. But each way of working has its own strengths and weaknesses; if you are aiming for large teams working together on large projects, I would not recommend this. That is not because of readability, but because the code is so terse that you would, even with 2 people, be changing the same code a lot of the time, so it's more efficient to do it alone or in pair programming (which does work well; also remotely in an APL-like in my experience).

Re:ngn/k, an AGPL K interpreter by msla on Thursday January 23, 2020 @12:55AM (#22125194)
> As this thread and post proves, quite a lot of people have no issue reading + understanding it.

This thread, like this implementation, is a troll, a joke, and everyone trying to appreciate this thing as a language is being pranked.

Re:ngn/k, an AGPL K interpreter by kick on Friday January 10, 2020 @12:03PM (#22012437)
Think of it like it's math. If you have to explain the value of e every time you use it, the value of your work to onlookers diminishes, and it can no longer be held in the mind of any reader.