Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That naming convention makes perfect sense to the mathematician, so why not? It's why we use `for(int i = i; i < n; i++)` in for loops; its the mathematical sigma sum of values with the same naming convention


A loop counter doesn't carry much semantic weight so it gets a short name. Doing that for important things that deserve a descriptive name is the problem. Maybe passable with literate programming, but even Knuth's code is pretty inscrutable due to transclusions everywhere.


The question to me always was, does it makes sense in the way of, it is intuitivly understandable, or does it only make sense, if it was drilled into you long enough?

(I suspect the latter)


Harder maths are often so inscrutable that single letter variables are also the least of your problems.


Certainly. But on top of the hard problem, I don't like to be distracted by unreadable code ..


Which is why Haskell likes single letter variables too


Oh yeah. And if you're like my dad you call them "do loops" not "for loops"


While the Americans have encountered first the "DO loops" of FORTRAN (1954), the "for loops" of ALGOL are derived from the earlier use in Europe of "for loops" in programming (actually "für loops", Heinz Rutishauser, 1951), which in turn had been preceded by the use in mathematics of the "for-all" quantifier (Gerhard Gentzen, 1935), which includes an implicit loop (and in many more recent programming languages, starting with Alphard in 1974, it is preferred for the most frequent loops to use a syntax essentially identical to the mathematical notation from 1935, i.e. like "forall X in A do ...").




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: