Talk:Loops/For with a specified step: Difference between revisions

From Rosetta Code
Content added Content deleted
Line 4: Line 4:
The recent purge https://rosettacode.org/mw/index.php?title=Loops%2FFor_with_a_specified_step&type=revision&diff=322790&oldid=322251 struck me as rather aggressive. What constitutes a "useless" example? Knowing that the for statement does ''not'' support a step of 2 could itself be useful. I feel those examples should be reinstated. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 11:40, 3 February 2021 (UTC)
The recent purge https://rosettacode.org/mw/index.php?title=Loops%2FFor_with_a_specified_step&type=revision&diff=322790&oldid=322251 struck me as rather aggressive. What constitutes a "useless" example? Knowing that the for statement does ''not'' support a step of 2 could itself be useful. I feel those examples should be reinstated. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 11:40, 3 February 2021 (UTC)
: I understand that’s what [[Template: omit from|omit from]] is for: That a certain task is just simply impossible in a certain language.
: I understand that’s what [[Template: omit from|omit from]] is for: That a certain task is just simply impossible in a certain language.
: [[Special: Diff/322790|I have narrowed down the task]], because I think it is ''generally known'' counting loops (<tt>for</tt>-loops) can be written as ''semantically equivalent'' conditional loops (<tt>while</tt>-loops). I don’t need nobody to show me that, it’s “useless” for me and probably many many other users. I consulted this wiki page to see various flavors of how languages provide means to alter step widths (<tt>step</tt>, <tt>range</tt> with width specifier, etc.), not to see various flavors of [[Loops/While|<tt>while</tt> loops]], you know what I mean?
: [[Special: Diff/322790|I have narrowed down the task]], because I think it is ''generally known'' counting loops ([[Loops/For|<tt>for</tt>-loops]]) can be written as ''semantically equivalent'' conditional loops (<tt>while</tt>-loops). I don’t need nobody to show me that, it’s “useless” for me and probably many many other users. I consulted this wiki page to see various flavors of how languages provide means to alter step widths (<tt>step</tt>, <tt>range</tt> with width specifier, etc.), not to see various flavors of [[Loops/While|<tt>while</tt> loops]], you know what I mean?
: I strongly oppose reinstating dozens of languages inserting a statement to this page, like: “This isn’t possible, but a <tt>while</tt>-loop can achieve the same: <nowiki><</nowiki>code example>”. Well, duh!? It’s ''just'' noise. Please leave that out and use [[Template: omit from|omit from]].
: I strongly oppose reinstating dozens of languages inserting a statement to this page, like: “This isn’t possible, but a <tt>while</tt>-loop can achieve the same: <nowiki><</nowiki>code example>”. Well, duh!? It’s ''just'' noise. Please leave that out and use [[Template: omit from|omit from]].
: [[User:Root|Root]] ([[User talk:Root|talk]]) 11:55, 3 February 2021 (UTC)
: [[User:Root|Root]] ([[User talk:Root|talk]]) 11:55, 3 February 2021 (UTC)

Revision as of 11:57, 3 February 2021

The Ada solution might also consider using simple loop and then applying a (simple) function to generate the “loop variable”. For example, to loop from 0 to 10 by 2, you might loop from 0 to 5 by 1 and then set another var to the loop var times 2 at each step. (This technique is much more common when trying to loop by floating-point quantities, where feeding them directly into a C-like loop is inadvisable in many languages due to the need to manage imprecision in a way that doesn't blow up in your face...) —Donal Fellows 23:38, 12 July 2009 (UTC)

"useless" examples?

The recent purge https://rosettacode.org/mw/index.php?title=Loops%2FFor_with_a_specified_step&type=revision&diff=322790&oldid=322251 struck me as rather aggressive. What constitutes a "useless" example? Knowing that the for statement does not support a step of 2 could itself be useful. I feel those examples should be reinstated. --Pete Lomax (talk) 11:40, 3 February 2021 (UTC)

I understand that’s what omit from is for: That a certain task is just simply impossible in a certain language.
I have narrowed down the task, because I think it is generally known counting loops (for-loops) can be written as semantically equivalent conditional loops (while-loops). I don’t need nobody to show me that, it’s “useless” for me and probably many many other users. I consulted this wiki page to see various flavors of how languages provide means to alter step widths (step, range with width specifier, etc.), not to see various flavors of while loops, you know what I mean?
I strongly oppose reinstating dozens of languages inserting a statement to this page, like: “This isn’t possible, but a while-loop can achieve the same: <code example>”. Well, duh!? It’s just noise. Please leave that out and use omit from.
Root (talk) 11:55, 3 February 2021 (UTC)