4 ms·
While I understand why 2D is objectively better choice for expressing algorithms, I believe 1D is better suited for our minds. 2D is just hard to parse. You don
by mlajtos 5y ago
While I understand why 2D is objectively better choice for expressing algorithms, I believe 1D is better suited for our minds. 2D is just hard to parse. You don't know where to look and how to proceed. With 1D you start in the upper left corner, and there is only one direction to follow. Less is more.
I read what you have wrote on paperalgo and I like it a lot. It's terse and thought out. I think pattern matching makes more sense than conditionals and looping, but it is easier to transliterate it from different languages. ↑ from Smalltalk just feels right.
- kragen 5y agoInteresting, I usually think of code as being easier to parse when it's laid out in 2D like this: enum { size = 8192 }; int main() { char *n = "tmp.mmapcrash"; int f = open(n, O_RDWR | O_CREAT, 0666); if (f < 0) err(errno, "open: %s", n); for (size_t i = 0; i < size; i++) { if (write(f, "x", 1) < 0) err(errno, "write"); } .... rather than in 1D like this: enum { size = 8192 }; int main() { char *n = "tmp.mmapcrash"; int f = open(n, O_RDWR | O_CREAT, 0666); if (f < 0) err(errno, "open: %s", n); for (size_t i = 0; i < size; i++) { if (write(f, "x", 1) < 0) err(errno, "write"); } ... Are you saying that your experience it's the other way around? Pattern-matching makes some code a lot easier to express and understand, but it's true that there are some languages where you end up having to kind of hand-translate it into a nest of conditionals and whatnot. It's kind of mindless work, though, so I don't really feel like I'm missing anything important in the pattern-matching representation of conditionals in paperalgo.