News for hackers. Stuff that matters.
Re:Impending kOS by ah- on Saturday October 18, 2014 @05:06PM (#8476303)
k/q really doesn't have to be this unreadable, that's just Arthurs style. Here's some code in C by him for comparison: http://kx.com/q/cs107/a.c
Re:Impending kOS by nemo1618 on Saturday October 18, 2014 @08:30PM (#8476858)
I tried cleaning it up a bit: https://gist.github.com/lukechampine/f54fce8fd756254cefb2

But the actual meaning of the program is still lost on me. I can only guess it has something to do with parsing files (note the checks for curly braces). Feeding it its own source code produces some output, but I have no idea what it actually modified.

Re:Impending kOS by epsylon on Sunday October 19, 2014 @05:56AM (#8477808)
It's a solution to CS107 assignment 1 : http://web.stanford.edu/class/cs107/assign1.html
Re:Impending kOS by nemo1618 on Sunday October 19, 2014 @11:43AM (#8478538)
Guess I could have just looked at the URL, huh. Well, it was fun trying to reverse Whitney's code anyhow.

Humorously, it looks like this code would have received a poor grade. It meets just about every standard for low quality outlined here: http://web.stanford.edu/class/cs107/landmarks.html, particularly "Fast code which doesn't work quite right." (Due to an off-by-one error, this code fails to properly reconstruct the example text.)

Re:Impending kOS by asd02 on Sunday October 19, 2014 @12:38PM (#8478716)
> Due to an off-by-one error, this code fails to properly reconstruct the example text

What's your example? It seems to work fine to me on "{all is well}{ell that en}{hat end}{t ends well}"

Re:Impending kOS by ah- on Sunday October 19, 2014 @07:04PM (#8479952)
In case anybody is still interested, it's now up on http://kparc.com/cs107/readme
Re:Impending kOS by Torn on Saturday October 18, 2014 @08:41PM (#8476869)
The original is 404ing, do you have a mirror?
Re:Impending kOS by nemo1618 on Saturday October 18, 2014 @09:00PM (#8476901)
Re:Impending kOS by lobster_johnson on Sunday October 19, 2014 @08:21PM (#8480134)
That's the original C file, where did your "cleaned-up" version go?
Re:Impending kOS by icsa on Monday October 20, 2014 @07:47PM (#8485169)
Here is a style for K (http://nsl.com/papers/style.pdf) 1995. Interestingly, most of the concepts still apply.

I believe the audience is developers using K in a commercial/production environment.

The biggest differences, compared to Arthur's style of writing, are: * Less code on each line * A separate comment column on each line * Nominal use of spaces for readability

Re:Impending kOS by sohagan857 on Saturday October 18, 2014 @05:29PM (#8476386)
Q isn't unreadable. Its implemented in standard English words.http://code.kx.com/wiki/Reference K is considered unreadable by many.
Re:Impending kOS by ah- on Saturday October 18, 2014 @05:41PM (#8476417)
I was more referring to the almost exclusive use of single letter variable names. If one would use at least short words to name things, the implementation would be a whole lot more understandable.
Re:Impending kOS by ANTSANTS on Saturday October 18, 2014 @07:30PM (#8476718)
Good lord, I need a drink now.
Re:Impending kOS by cheez on Saturday October 18, 2014 @05:49PM (#8476445)
If that's true, why aren't there DSLs that compile to k?