Hacker News new | ask | show | jobs
by fluidcruft 1250 days ago
Again, machines are not the purpose of computing.

"The purpose of computing is insight, not numbers." (Hamming)

Machines and notation are both tools. Aesthetics do matter particularly for tools used for thought.

There is no correct answer and imposing one tool's limitations on everything is not useful. Particularly not "just because Dijkstra said so".

Sometimes 0-indexing works well. Sometimes it sucks. Sometimes 1-indexing works well, sometimes it sucks.

I did in fact give you a reference. The fact that it's irrelevant to you and dismissed as merely "aesthetics" and that you think a computer scientist is the domain expert of all science tells me everything that needs to be said--you never deal with questions of correctness beyond mere transcription.

What I said is that moving from Octave/Matlab to python's zero indexing sometimes does truly suck. And I mean it. That doesn't mean 1-indexing never sucks or that I am inaware of Dijkstra's opinions. Having to arange(1, N+1) or 1:N+1 or whatever everywhere isn't eliminating off-by-one errors.

Matlab and Octave and FORTRAN etc are domain languages designed for linear algebra. They are of course going to be more convenient for their domains.

1 comments

In language design, a choice is necessary. You can support all possible indexing strategies, but that's problematic for a whole different set of reasons. So you need to choose, index from 1 or from 0. I've never once thought my algorithmic implementation is mucky because of the index from zero, inclusive lower bound, exclusive upper bound policy languages. I used to regularly lament how ugly the MATLAB code was for that reason. Unless MATLAB had bolted on another language feature to solve that problem, I'll let my extensive (albeit 15 years old) use of MATLAB in signal processing algorithm implementation be my aesthetic guide.
I'm not here to defend Matlab as some aesthetic language (in fact why on earth they haven't poached more of Octave's syntax improvements remains an eternal mystery) so if you just want to bitch about Matlab go right ahead ;)
The scars run deep.