Talk:Compare a list of strings: Difference between revisions

→‎Undiscussed deletion (JavaScript) June 5 2016: {{ Translation of JavaScript }} tag broken by undiscussed deletion
(→‎Undiscussed deletion (JavaScript) June 5 2016: {{ Translation of JavaScript }} tag broken by undiscussed deletion)
 
(2 intermediate revisions by 2 users not shown)
Line 93:
 
: That requirement should be seen in combination with the guideline for presenting the solution in a minimalistic way, rather than listing a full program.
 
:: Not a problem, I've removed it. -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 01:26, 3 July 2014 (UTC)
 
: 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)''.
Line 126 ⟶ 128:
: I hope that explains it.
: Cheers! --[[User:Smls|Smls]] ([[User talk:Smls|talk]]) 11:23, 2 July 2014 (UTC)
 
<br>
 
-----
 
<br>
{Because of the somewhat (above) unusal HTML formatting, I couldn't intersperse my comments on the incorrect part of your post.}
<br>Regarding your (above) example of:
<lang rexx>ifEqual('strings') /* All equal */
ifAscend('strings') /* Strictly ascending */</lang>
As written, it would unfortunately (at worst) raise a REXX syntax error, or it'll execute and then pass a '''0''' or '''1''' to the host (operation system), and then try to run (execute) the '''0''' (or '''1''') program.
<br>It's not a proper method to be used to invoke a function within REXX for this kind of ('''if''') test, but I understand your underlining meaning. &nbsp; The method used in REXX would be:
<lang rexx> if ifEqual(strings) then say 'strings are all equal.'
if ifAscend(strings) then say 'strings are ascending.'</lang>
Of course, the code that I used issues a message (via the '''say''' verb), but anything could be done there (after the '''then'''), such as set a variable or somesuch.
 
I've changed the function names so that it "reads" better:
<lang rexx> if isEqual(strings) then say 'strings are all equal.'
if isAscend(strings) then say 'strings are ascending.'</lang>-- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 01:26, 3 July 2014 (UTC)
I choose to use a list of (five) strings as I noticed that some programming examples wouldn't display the correct results for one (token) string or a empty (null) string (as being ''all equal'' AND ''all ascending''). &nbsp; That's why it's productive to show output of the language entries (to show that it can handle the border situations, among other things). &nbsp; I don't know the subtleties of most languages when comparing strings to nulls, for instance; &nbsp; is a (non-null) string less than a null, greater than a null, equal to a null ··· ?
 
Having a common structure is a nice thing to aim for, but not all languages have a common structure that can be used (or understood by a novice). &nbsp; I assume it would be up to a knowledgeable programmer to verify if the program (in lue of any output) would be correct. &nbsp; Sometimes it isn't good to force a square peg through a round hole. -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 01:26, 3 July 2014 (UTC)
 
==Undiscussed deletion (JavaScript) June 5 2016==
 
:I notice that a functional JavaScript example was deleted without discussion on 5 June 2016, and replaced with an imperative example.
:Addition is generally preferable to deletion, particularly where approaches diverge, but more importantly, proposed deletions do need to be motivated and explained here on the discussion page.
:Unless there are objections, I propose to restore the functional version, so that readers of JavaScript are allowed see both approaches, and so that readers of AppleScript are less puzzled by the 'Translation of JavaScript' tag – the link from which was inadvertently broken by this undiscussed deletion. [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 19:21, 4 November 2016 (UTC)
9,655

edits