Content deleted Content added
Thundergnat (talk | contribs)
→‎using of intermediate variables: Sorting three variables
m →‎using of intermediate variables: added some statements.
Line 164:
<br>-- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 19:59, 30 April 2017 (UTC)
:Quote:|''Sort (the values of) three variables (X, Y, and Z)''| Seems to me that says use three variables. For something like this, in Perl 6 normally I'd just assign three values to an anonymous array and sort that, E.G. <code>say [9 7.7444e4 -12].sort</code>. The task could just say "sort three numeric values by magnitude and three string values in some lexical order" without really delving into how the values are stored or accessed. Once it specifies variables and especially numbers of variables, it is adding constraints that in this case have little to do with the main task.--[[User:Thundergnat|Thundergnat]] ([[User talk:Thundergnat|talk]]) 20:55, 30 April 2017 (UTC)
 
:: Yes, your first statement (above) is dead on, '''use three variables X, Y, and Z.''' &nbsp; I intentional didn't specify (just) three values. &nbsp; However, those aren't intermediate variables, they are the primary variables &nbsp; (that contain the original defined values). &nbsp; The original question is where did you see the mention of &nbsp; ''intermediate variables'' &nbsp; in the task's requirements?
 
:: As an aside, I don't recall seeing the phrase &nbsp; ''sort numeric values by magnitude'' &nbsp; in any other Rosetta Code sorting task, I assumed that that's what sorting does (when sorting numbers).
 
:: As for delving into how the values are stored, some computer language store numbers in different formats/methods, depending on what format (or kind of) the number is, so I tried to make allowances for those languages in the wording of the task. &nbsp; I was trying to be generic (and inclusive) as possible.
 
:: In addressing the main task itself, the specific mention of sorting <u>three</u> variables is crucial to the task; &nbsp; it is an old and well-known programming topic of discussion elsewhere. &nbsp; Knowing that some programming languages don't care what is stored in a variable, and other language have very particular syntactic rules (casting or typing?) about their construct (that is, how the data is stored --- floating point vs. integer for instance), &nbsp; I tried not to exclude some (well, probably most) programming languages via the task's wording. &nbsp; -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 21:35, 30 April 2017 (UTC)