Sujet : Re: Loops (was Re: do { quit; } else { })
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.lang.cDate : 18. Apr 2025, 14:37:26
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vttkio$34as4$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 17.04.2025 02:26, Keith Thompson wrote:
bart <bc@freeuk.com> writes:
On 16/04/2025 21:03, Keith Thompson wrote:
bart <bc@freeuk.com> writes:
On 16/04/2025 06:35, Janis Papanagnou wrote:
On 15.04.2025 22:46, bart wrote:
On 15/04/2025 20:07, Scott Lurndal wrote:
[...]
Real for loops _are_ a three-way construct.
>
[...]
>
Any step other than 1 is unusual. [...]
>
Nonsense. Arithmetic loop steps other than one are noting unusual
and been supported by programming languages (and also been used)
since decades in programming.
>
So what are you claiming, that the majority of loops in any given
program will have steps other than +1 or -1?
Exactly, because "unusual" and "the majority" are the only
possibilities.
>
I'm not sure what you're getting at.
I think the misunderstanding is over the meaning of the rather
vague word "unusual".
Did you really think that Janis was claiming that "the majority of
loops in any given program will have steps other than +1 or -1"?
The "majority" is as a typical phrase introduced by bart as sort of
substitute for an argument. (I usually avoid claims about presumed
"majorities", about what "all" or "most" people here or everywhere
else do.)
It can be easily looked up what I wrote; but bart regularly just
moves goalposts when he's lost, instead of accepting the obvious
facts (or other opinions based on experiences or else).
To reformulate (from memory) some basics I actually said...
Statistics of 98% for simple loops are close to reality, IMO.
Increments of +1/-1 were the rationale for Pascal's decision to
support just such primitive loops.[*]
You are lacking flexibility with only such primitive loops.
Many language provided support more more types of useful loops.
"C" loops have a flexibility that I appreciate and that I use.
Statistical numbers have obviously changed for non-simple loops
for languages that allow such usages.
(...and maybe some more that I don't recall any more.)
Janis
[*] I'd like to take the opportunity to say that Pascal supports
more than just simple "counted" loops; you can also iterate over
any "scalar"[**], say, if you have an 'enum' type "red,blue,green"
you can iterate from "red" to "green".
[**] "Scalar" with non-mathematical meaning; every countable type.
[...]