4 ms·
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 sig
by glouwbug 2y ago
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
- seanhunter 2y agoOh yeah. And if you're like my dad you call them "do loops" not "for loops"
- adrian_b 2y agoWhile 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 ...").
- lukan 2y agoThe 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)
- kevin_thibedeau 2y agoA 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.
- nextaccountic 2y agoWhich is why Haskell likes single letter variables too