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

(→‎"useless" examples?: what’s a for-loop?)
 
(16 intermediate revisions by 6 users not shown)
Line 7:
: 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)
:: 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? <del>2) Why delete Delphi completely and just the code from Dragon?</del> 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.
 
Line 25:
::: My intentions were to ''qualify'' the task requirements, not ''alter'' them. It’s difficult to phrase: I wanted to still permit examples like C, where it is just idiomatic, “normal” to write a conditional expression <tt>i < 10</tt> and statement <tt>i += 2</tt>, because <tt>for</tt>-loops with a step size of <tt>1</tt> look just the same.
::: [[User:Root|Root]] ([[User talk:Root|talk]]) 13:37, 3 February 2021 (UTC)
::::There is a problem with this: even if a language does not have a for/by statement, there may be an idiomatic equivalent that is not a while loop. The most common is probably an iterator/enumerator/generator or whatever you call that, e.g. in Python. Except that the tasks explicitly forbids the case where the enumeration is not suitable to very large ranges, which I suppose means we don't want a solution where we loop other a range that in the background builds a full list of values in memory. Except it's how you do it in R. You also want to delete the R solution? Then we are losing knowledge: how to achieve that task, as idiomatically as possible, even if it's not perfect? [[User:Bastet|Bastet]] ([[User talk:Bastet|talk]]) 16:37, 3 February 2021 (UTC)
::: Deletion '''very rarely''' adds value.
::: You may find a contribution 'useless' for your purposes, but we really don't need to know that, and it's '''not''' up to you to make that decision on behalf of others.
::: If you genuinely think that you may have spotted one of the '''very''' rare cases where a deletion could somehow add significant value, and that others have somehow missed what you think you can see, then open that discussion, and see what consensus emerges. At worst, you may learn something.
::: Don't execute the prisoner first, and then consult the court afterwards. [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 18:31, 3 February 2021 (UTC)
:::: [[User:PureFox|PureFox]]: Giving languages a chance to explain that a task can’t be implemented exactly as required isn’t the problem, but we gotta set ''some'' limit: Every Turing complete language can achieve any task. In this case though, it just leads to unnecessary repetition, because [https://en.wikipedia.org/wiki/For_loop#Equivalence_with_while-loops transforming <tt>for</tt>-loops to <tt>while</tt>-loops isn’t “sorcery”]. I just prefer to write in the task’s introduction “no <tt>while</tt> loops”, so ''this'' doesn’t ''bloat'' the article, you know.
:::: [[User:Bastet|Bastet]]: Huh. Yes, I wanted to exclude poorly scalable solutions. However, my wording says “''custom'' enumerator”. As far as I understand the [[{{ARTICLEPAGENAME}}#R|<tt>seq</tt> function used in R]] is part of the language, right? It’s not a ''custom'' addition, [[Loops/Wrong ranges#R|it’s already there]], so it’s an idiomatically valid solution.
:::: [[User:Hout|Hout]]: This is a Wiki, so “shoot first, ask questions later” is OK since everything is in the history, we ''can'' “revive” earlier revisions. Wikipedia advertises this as [https://en.wikipedia.org/wiki/Wikipedia:Be_bold “Be bold!”]
:::: Yeah, well, maybe this is one of those “rare” occasions deleting some content is warranted. Can you ''actually'' argue ''for'' repeating ''umpteen'' times “a <tt>for</tt>-loop can be rewritten as a <tt>while</tt> loop <nowiki><</nowiki>code example>” significantly ''increases'' the value? It rather improves usability to ''omit'' such information. If you can make a good point though, I suggest to deliberately ''widen'' the task’s requirements to “demonstrate ''any kind of'' loop with a specified step width”, so this kind of discussion never pops up again. [[Special: PermaLink/322251|On February 2]] I read “Demonstrate a for-loop […]” and I just couldn’t (and still can’t) subsume [[Loops/While|''<tt>while</tt> loops'']] under the term “[[Loops/For|for-loop]]”, in consequence I deleted those implementations.
:::: [[User:Root|Root]] ([[User talk:Root|talk]]) 07:15, 4 February 2021 (UTC)
:::::It seems you don't understand the point of the site. For each language, show how it's done. For the reader interested in language A, it doesn't matter that something is written for languages B, C... Z. Besides, it's not always a while loop, as I have already explained. [[User:Bastet|Bastet]] ([[User talk:Bastet|talk]]) 08:05, 4 February 2021 (UTC)
:::: Good grief ... "''This is a wiki, so ...''" "''In consequence I ...''" ''"I just couldn't ...''" ?
:::: Are you serious ? Forgive me, but this is not Wikipedia, the software used is utterly irrelevant, and to protect yourself from a whirlpool of monologue, and the site from an episode of vandalism, you do need to consult and discuss before you rush blindly and self-righteously into deletions. [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 08:51, 4 February 2021 (UTC)
: I'm throwing my hat into the ring for reversing these changes. If I'm learning a new language and come to Rosetta Code to see how it does a for loop, it's far more useful to see a demonstration of that language's nearest equivalent than it is to see it's been omitted. Furthermore, there is more nuance to many language's iteration constructs than simply considering them to either be generators or clones of one particular language's <code>while</code> and <code>for</code> loops. --[[User:Chunes|Chunes]] ([[User talk:Chunes|talk]]) 10:02, 4 February 2021 (UTC)
:: Seconded. More value was '''removed''' than added, and prior discussion would have protected not only Rosetta value, but also contributor time. [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 10:40, 4 February 2021 (UTC)
 
:: +1 from me too. If a language has the feature then it should be shown; (we might argue about if other non-feature implementations may also be shown). If a language misses the feature then showing that languages idiomatic replacement, especially for basic constructs, should be encouraged. "Esoteric" languages, for example, may be specifically esoteric in their methods of implementing common constructs.
:: Entrys can say msomething like "we don't have that construct but...".
:: Some tasks specifically state that X should be used. Not showing X may always cause issues so starting with an explanation may be best, but gives no guarantee. --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 11:31, 4 February 2021 (UTC)
 
::+1 as well. For some languages, the requirement just doesn't make sense. For esoteric languages such as brainf*ck of course, but also for more traditional ones: a for loop in assembly? Nope, it's a jump. I can imagine that a few other simplistic languages have goto but no loop. And of course, a range/seq/iterator is yet another approach. Often several are possible (Ruby comes to mind). Rosetta Code can't rigid. [[User:Bastet|Bastet]] ([[User talk:Bastet|talk]]) 14:06, 4 February 2021 (UTC)
 
:: Done. This thread has already wasted more time than the "not liked by Root" did collectively over the last decade. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 17:07, 4 February 2021 (UTC)
7,806

edits