Someone once posted a C program here on HN, where each line, even the comments, seemed to "line up" in 6- or 8- character blocks with a space in between. It made the whole program look sort of like a table.
I felt it was sort of like poetry. I unfortunately no longer have a link to it, and once looked very hard but couldn't find it. I would be extremely appreciative of someone else saw it and had a link. If I recall correctly it was a type of interpreter, I remember it having code for parsing.
I appreciate your help, but I feel like its unlikely to be in there since it wasn't really obfuscated - it was meant to be clear in some sense of the word and had a bunch of comments explaining it.
The comments sounded natural, but lined up so each Nth column was a space (or punctuation) all of the way down the code. None of the things I am seeing in that list seem to have quite the same layout. There was some comment about it like "some people feel code should be beautiful to enjoy debugging" or something along those lines but I don't really remember. I have been looking for a long time though and really wish I had saved it properly when I first saw it.
public static int bitCount(int i) {
i = i - ((i >>> 1) & 0x55555555);
i = (i & 0x33333333) + ((i >>> 2) & 0x33333333);
i = (i + (i >>> 4)) & 0x0f0f0f0f;
i = i + (i >>> 8);
i = i + (i >>> 16);
return i & 0x3f;
}
It was like magic for me when I encountered it first time.
Came here to say this, I first saw this in the book Hackers Delight which is full of 200X-me's mind blowing stuff.
It really opened a door to writing (arb)GPU shaders where at the time if's weren't allowed and trying to cut branches from PS2/GameCube/Xbox code
Comments (380) 116 threads
Earlier commentsI felt it was sort of like poetry. I unfortunately no longer have a link to it, and once looked very hard but couldn't find it.
I would be extremely appreciative of someone else saw it and had a link. If I recall correctly it was a type of interpreter, I remember it having code for parsing.
The comments sounded natural, but lined up so each Nth column was a space (or punctuation) all of the way down the code. None of the things I am seeing in that list seem to have quite the same layout.
There was some comment about it like "some people feel code should be beautiful to enjoy debugging" or something along those lines but I don't really remember.
I have been looking for a long time though and really wish I had saved it properly when I first saw it.
- haskell:
- js: (using https://github.com/tc39/proposal-slice-notation for conciseness) # Cartesian product of 2 or n lists- haskell:
- js:All comments shown.
Couldn't load more comments. Check your connection and try again.