Jump to content

Talk:Compare a list of strings: Difference between revisions

m (→‎task requirement of a variable name: added a canine comment.)
Line 88:
 
-----
 
: That requirement should be seen in combination with the guideline for presenting the solution in a minimalistic way, rather than listing a full program.
 
: In a complete real-life program it ''would'' be strange to name your list of strings "strings", but if you present each test as a lone expressions (like the task description intended and most of the other solutions already do), then it really helps readers to use a generic variable name like that ''(because it makes the expression more self-descriptive)'', and it helps to use the same name in every solution ''(because that makes it easier to compare the solutions of different languages)''.
 
: The REXX solution could be presented like this, to make it conform to said guideline ''(which I intend to upgrade to a requirement, see the top section of this talk page!)'':
{| style="border:none; border-collapse:collapse; margin:0 auto"
|-
| style="vertical-align:top" |
<div style="margin:0; padding:0 0.5em; border:solid 1px #666; background:#EEF">
 
Assuming that <code>strings</code> was created using the "simple arrays" method shown at [[Arrays#REXX]], the tests can be performed like this:
 
<lang rexx>ifEqual('strings') /* All equal */
ifAscend('strings') /* Strictly ascending */</lang>
 
...using these custom procedures:
 
<lang rexx>ifEqual: procedure; parse arg list
...
...
 
ifAscend: procedure; parse arg list
...
...</lang>
</div>
|}
: ...of course with the ellipses replaced with the actual code of those procedures, but other than that, nothing else needs to be shown.
 
: As you can see, this would make it very easy to compare what's going on there to - say - what's going on in the Python solution, even for readers who know neither REXX nor Python. That's the idea behind asking solutions to be presented with a common structure and assuming a common input variable name, and without distractions such as showing how to populate & print arrays ''(there are enough other tasks for that, which can be linked to if it's non-obvious)''.
 
: Also, as the above code listing demonstrates, I didn't mean that you should feel compelled to use the name "strings" inside your custom procedures etc. - only in the main test expressions, to make them clear and easy to compare.
 
: I hope that explains it.
: Cheers! --[[User:Smls|Smls]] ([[User talk:Smls|talk]]) 11:23, 2 July 2014 (UTC)
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.