5 ms·
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 http://kx.com/q
by ah- 12y ago
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 http://kx.com/q/cs107/a.c
- sohagan857 12y agoQ isn't unreadable. Its implemented in standard English words.http://code.kx.com/wiki/Reference http://code.kx.com/wiki/Reference K is considered unreadable by many.
- ah- 12y agoI 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.
- cheez 12y agoIf that's true, why aren't there DSLs that compile to k?
- ANTSANTS 12y agoGood lord, I need a drink now.
- nemo1618 12y agoI tried cleaning it up a bit: https://gist.github.com/lukechampine/f54fce8fd756254cefb2 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.
- Torn 12y agoThe original is 404ing, do you have a mirror?
- nemo1618 12y agoSure: https://gist.github.com/lukechampine/e759098e717e42bc11c5 https://gist.github.com/lukechampine/e759098e717e42bc11c5
- lobster_johnson 12y agoThat's the original C file, where did your "cleaned-up" version go?
- epsylon 12y agoIt's a solution to CS107 assignment 1 : http://web.stanford.edu/class/cs107/assign1.html http://web.stanford.edu/class/cs107/assign1.html
- nemo1618 12y agoGuess 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 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.)
- asd02 12y ago> 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}"
- ah- 12y agoIn case anybody is still interested, it's now up on http://kparc.com/cs107/readme http://kparc.com/cs107/readme
- icsa 12y agoHere is a style for K (http://nsl.com/papers/style.pdf 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