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

From Rosetta Code
Content added Content deleted
(→‎"useless" examples?: Added comments.)
Line 8: Line 8:
: [[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)
:: Since you're here: 1) what was so offensive about the Axe for loop, or rather where on earth is your first new point coming from at all? 2) Why delete Delphi completely and just the code from Dragon? 3) What suddenly changed to make that [Delphi] ''ten year old'' example completely unacceptable? There is a reason why this site has draft tasks, and you should be very cautious (and probably discuss things first) before altering a task that was reviewed and promoted to full task status a decade ago. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 12:33, 3 February 2021 (UTC)
:: Since you're here: 1) what was so offensive about the Axe for loop, or rather where on earth is your first new point coming from at all? 2) Why delete Delphi completely and just the code from Dragon? 3) What suddenly changed to make that [Delphi] ''ten year old'' example completely unacceptable? There is a reason why this site has draft tasks, and you should be very cautious (and probably discuss things first) before altering a task that was reviewed and promoted to full task status a decade ago. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 12:33, 3 February 2021 (UTC)
:::One of this site's unwritten rules (or at least I thought it was) is that you don't alter the descriptions of tasks which already have solutions ''without prior discussion'' and then set about removing implementations that don't fit.

:::Moreover, languages which don't support the feature in question are generally allowed some latitude to show how they would do it instead. This is much more informative than just omitting the language from the task altogether.

:::Without this rule, you could probably justify deleting half the examples on the site as not satisfying the task description in some form or another.

:::Frankly, I was amazed that the admins let the changes stand! --[[User:PureFox|PureFox]] ([[User talk:PureFox|talk]]) 13:12, 3 February 2021 (UTC)

Revision as of 13:12, 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 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)
Since you're here: 1) what was so offensive about the Axe for loop, or rather where on earth is your first new point coming from at all? 2) Why delete Delphi completely and just the code from Dragon? 3) What suddenly changed to make that [Delphi] ten year old example completely unacceptable? There is a reason why this site has draft tasks, and you should be very cautious (and probably discuss things first) before altering a task that was reviewed and promoted to full task status a decade ago. --Pete Lomax (talk) 12:33, 3 February 2021 (UTC)
One of this site's unwritten rules (or at least I thought it was) is that you don't alter the descriptions of tasks which already have solutions without prior discussion and then set about removing implementations that don't fit.
Moreover, languages which don't support the feature in question are generally allowed some latitude to show how they would do it instead. This is much more informative than just omitting the language from the task altogether.
Without this rule, you could probably justify deleting half the examples on the site as not satisfying the task description in some form or another.
Frankly, I was amazed that the admins let the changes stand! --PureFox (talk) 13:12, 3 February 2021 (UTC)