I'm working on modernizing Rosetta Code's infrastructure. Starting with communications. Please accept this time-limited open invite to RC's Slack.. --Michael Mol (talk) 20:59, 30 May 2020 (UTC)

Talk:Determine if a string is collapsible

From Rosetta Code

Harry S Truman[edit]

Yes, Truman's middle name is   S   with no period,   even though President Truman most often signed his correspondence with a period after the   S.     -- Gerard Schildberger (talk)

How strict are the requirements?[edit]

If somebody posts an example that works correctly, but doesn't use the 5 required example strings from the task description, should the entry be marked incorrect? --Thundergnat (talk) 01:52, 29 November 2019 (UTC)

As the author of the task being mentioned,   I'd mark it (somehow) as missing some of the required output   (like a modified   {{output?}}   template).   If there were an   incomplete output   (or other such wording) type of flag,   that would be usable/noticeable,   and   if   it got the attention of author of that programming entry.   Another possibility is the   {{needs improvement}}   template,   but that (I think) conveys that the program entry is to be improved.   But I guess what needs improvement is kinda up to whatever needs to be improved.   Some programs have the input(s) either within (inside) the program as statements or literal fields, or made available via parameters, or other (such as an input file).     -- Gerard Schildberger (talk) 04:42, 29 November 2019 (UTC)
An   incomplete output   (flag) template may not have the wording (and color) to convey the message that only   some   of the output is missing.     -- Gerard Schildberger (talk) 04:42, 29 November 2019 (UTC)
I'm not exactly sure what the word   strict   means in this context.   If the entry works correctly, but has no output at all, would that be sufficient grounds to flag the example/entry?   Or if only half (or some other fraction) of the output was shown, or another completely set of output   (albeit correct).   You ask to see 20   funny-bunny primes,   but I only show 10.   (I think those primes hippty-hop around).   Or worse yet, the output is somewhere else entirely   ---   such as a different page on some another website   (that also leaves cookies on the viewer's computer   ...   ugh).     As I understand it, it would.   But how does one who doesn't know the programming language well enough to know that the computer program works correctly, if all I have to judge its correctness is the output of that program?   I believe that is, in essence, the basis of (or for) flagging a programming entry.   If I know the programmer well enough, and if I think/know the programmer is conscientious enough, I'll sometimes enter a new talk topic on the programmer's user talk page.   -- Gerard Schildberger (talk) 04:42, 29 November 2019 (UTC)
Note that this Rosetta Code task says to use (at least) these/those five required examples.   It was my intent to not limit whatever examples to be used,   but to have a common base of output for comparisons (among the various computer programming language entries).   I must admit, I don't know of all the possible templates that are available and/or what is usable for such a purpose,   as some templates do more than others   --- such as adding an language entry to some category that can be examined later by reviewing a specific category of that computer programming language.   The template   {{improve}}   could be used as it comes close to what I intended to express.   The template   {{output?/beta}}   is another possibility,   but I don't know exactly what that's used for.     -- Gerard Schildberger (talk) 04:42, 29 November 2019 (UTC)
I'm not exactly sure what the word 'strict means in this context.
Hmm. Let me see if I can clarify. If somebody posts an example that works correctly, but doesn't use the 5 required example strings from the task description, should the entry be marked incorrect? Nope; can't make it any clearer than that. Ok. I'm going to assume from your rambling exposition that if somebody posts an example that works correctly, but doesn't use the 5 required example strings from the task description, it should be marked incomplete. Will do. --Thundergnat (talk) 14:58, 29 November 2019 (UTC)
This task requirements explicitly states to use the (following) five test strings (at least),   it didn't mention any others that had to be used.   Nowhere does the task requirements require that one has to use the string(s) that were used as examples shown in the task's preamble   (but you are free to use them as well if you want, along with any others that you want).   If you are misunderstanding or misreading the task's requirements, please re-read what is in the task requirements section.   If there is a problem of understanding or interpreting the task's requirements, this is the place to work it out.   It would also help to state specifically what example(s) you think weren't used by the REXX's entry from those five specifically mentioned in the task's requirements.   Please note that the REXX example did use the five test strings as per the task's requirements.   Also, please refrain from posting your categorizations of someone else's comments,   this is becoming somewhat rash and not what I expect from people using Rosetta Code.   If anything, I was hoping that some of the concerns I raised would discussed or even addressed.     -- Gerard Schildberger (talk) 17:29, 29 November 2019 (UTC)
<Gerard>: This task requirements explicitly states to use the (following) five test strings (at least),
<thundergnat>: If somebody posts an example that works correctly, but doesn't use the 5 required example strings from the task description, should the entry be marked incorrect?
<Gerard>: removed bogus flagging as all five strings were indeed used...
<Gerard>:(later) corrected an input field string in the program...
As it turns out the required five strings were not used. My marking the entries incomplete was not wrong despite your disparaging comments when you removed the "incorrect" markup. But somehow it is I that is made out to be the uncivil one. Pot, let me introduce you to kettle. --Thundergnat (talk) 21:41, 29 November 2019 (UTC)
I've just had a look at it and the problem seems to be that the third example string should end with "7777888" but the corresponding example in the REXX entry ends with "77788". The 'squeezable' task has a similar discrepancy. --PureFox (talk) 18:18, 29 November 2019 (UTC)
Thank you so much for that information.   I looked at that (REXX) output quite a few times and didn't see it.   It's amazing what a good pair of eyeballs does to defuse this situation.   I'll fix it them ASAP.     -- Gerard Schildberger (talk) 18:37, 29 November 2019 (UTC)

What does determine mean?[edit]

As the task is titled 'Determine if a string is collapsible' should there not be a non-collapsible example?--Nigel Galloway (talk) 14:07, 8 June 2020 (UTC)

There is a non-collapsible example,   the very first example is NOT collapsible.     -- Gerard Schildberger (talk) 19:01, 8 June 2020 (UTC)

Good question, and that "determine if" thematic framing of the task inevitably produces clear expectations of a String -> Bool predicate, returning True or False for a given string.

No, that is not what the task's requirement said;   determine if ...   --- and then the very next sentence states:   And if so, ....     -- Gerard Schildberger (talk) 19:01, 8 June 2020 (UTC)
The sentence after the title begins with the word "and" to helpfully lead you on to the rest of the description. There is enough extra info to finish the task successfully. Some may not have worded it that way, but those same people didn't give RC the task we have. We can all learn from criticism, but it should remain measured, helpful and polite. --Paddy3118 (talk) 21:13, 9 June 2020 (UTC)


That expectation is then lead completely astray into open fields, where no mention of any kind of test or predicate can actually be found in the detail of the sub-tasks. Hout (talk) 14:39, 8 June 2020 (UTC)

You can use any kind or manner of test(s) to determine collapsibility that you think is effective or deterministic,   and if the string can be collapsed,   then change (collapse) the character string to meet the task's requirements.     -- Gerard Schildberger (talk) 19:01, 8 June 2020 (UTC)

To put it another way, the title suggests writing and testing something like this:

containsConsecutivelyRepeatedCharacters :: String -> Bool
containsConsecutivelyRepeatedCharacters = (>) . length <*> (length . group)

and the tasks describe something quite different. A (String -> String) function like:

withoutConsecutivelyRepeatedCharacters :: String -> String
withoutConsecutivelyRepeatedCharacters = map head . group

which defines a new string but 'determines' nothing. Hout (talk) 14:48, 8 June 2020 (UTC)

In order to define a new string, one has to (or should) determine if it is collapsible,   and then modify the string.   And if not collapsible,   then don't modify the string.   No mention was made or inferred that one should/must return a boolean value.   Task requirements shouldn't necessarily be inferred from the task's title, but from the task's requirements themselves.     -- Gerard Schildberger (talk) 19:01, 8 June 2020 (UTC)
Fascinating. Let me see if I've understood you correctly. You're saying that we shouldn't expect the title to describe the task ?
Quite a creative and innovative approach, if that's right ...
It suggests an interesting new Rosetta task, perhaps entitled "List all Rosetta tasks which are not described by their title, excluding this one". (Though obviously, the task requirement itself would be quite different, to avoid contradiction and confusion). Hout (talk) 20:26, 8 June 2020 (UTC)
Hout, I believe (from what I read of your remarks) that you are being deliberately obtuse.   Nowhere did I say that you shouldn't (or should) expect the title to describe the task.   In most cases, the Rosetta Code task does mention what the task is   about   however,   sometimes in a general way.   That is why there is normally a task description (and/or definitions), and why there are usually stated task requirements.   An example would be   long primes.   That, in itself, does not describe the task.   It does, however, suggest that the Rosetta Code task is about long primes.   If you're not sure what the task is about,   then read the task's preamble and pay particular attention to the task's requirement(s).   Failing that, observe the other computer programming examples (entries) and their output.   I have no idea how (or why) you are making such foolish assumptions and suggestions, but you are free to make all the whimsical lists at your leisure.   Your discourse is not productive and antagonistic in nature.   I replied honestly and seriously, taking your query to be meaningful, but you are deliberately misunderstanding what I simply and clearly stated, and staying into something that I did not state nor imply.   Perhaps if you could backup a bit and re-read what you posted and reflect on what was written.   I cannot take your statements in a meaningful way as you seem to make up fallacious statements of what I previously wrote.   If you fail to understand what I wrote, than say that instead of deliberately misunderstanding me and misstating/misinterpreting what I posted.   There is no reason to be impolite or be facetious to the point of being absurd.   That serves no purpose here.     -- Gerard Schildberger (talk) 21:07, 8 June 2020 (UTC)
You say "No mention was made or inferred that one should/must return a boolean value."
I for one certainly deduced and concluded from "Determine if ..." that a truth value was to be produced.
Or perhaps by 'inferred' you actually meant 'implied' ?
(There generally seems to be bit of slippage between language and intention here. But no matter – the pruning of repeated characters, even if unaccountably mislabelled as the detection of repeated characters, is not an obscure or subtle exercise). Hout (talk) 21:27, 8 June 2020 (UTC)
Gerard Schildberger, I believe (from what I read of your remarks) that you are being deliberately obtuse.   The null string is only non-collapsible by axiom. Are you saying that there is a function that can determine if a sting is collapsible faster than trying to collapse it? Looking at the Rexx solution where does it first perform that test? Looking at the Rexx output where has it determined if the string was collapsed, even for the null special case? Why would an non-colapable by the rules rather than axiom example not be an improvement? I think that the title is misleading, and worse the text specification is nonsense--Nigel Galloway (talk) 14:04, 9 June 2020 (UTC)

Back to draft ?[edit]

This task has some serious problems, and seems to have been promoted to full task prematurely. See the discussion below under 'What does determine mean ?'.

The fudged explanations offered so far of the obvious gap between task description and task tests seem unlikely to convince many, but the task is probably retrievable, if its quality can be improved.

My feeling is that it probably needs to go back to draft status, until the defects in its test set, and in the broken relationship between those tests and the name of the task, have been taken back to the repair shop, and emerged in a more convincing state of health. Hout (talk) 19:44, 9 June 2020 (UTC)

Specifically

  1. The collapsibility test foregrounded by the Determine if ... title needs to be included (prominently and thoroughly) in the task requirements.
  2. The test predicate and the repetition pruning (unmentioned in the title, but perfectly reasonable) need to be separately tested, as they are quite different coding exercises. A predicate test can exit quickly – as soon as a single consecutive repetition is detected, whereas a string rewrite (repetition pruning, in this case) has to continue all the way to the end in search of further repetitions.
  3. The task lacks any stretch element. An obvious possibility is to require the testing and (separately) compression of very long strings (brought in from file or computationally defined), which are beyond the scope (for some languages) of the obvious recursive solutions to these two coding tasks (the early-exit testing identified by the task title, and the quite different long-haul pruning which dominates the test strings).

Hout (talk) 22:14, 9 June 2020 (UTC)




I don't see why every Rosetta Code task needs (or should have) a   stretch element   I understand that some Rosetta Code tasks have   extra credit   or   stretch goals,   but I choose not to have them as having a multi-thousand (or multi-hundred) character string(s) would serve no purpose.   Stating that a Rosetta Code task lacks any   stretch element   isn't a legitimate reason for reverting a task to a draft task.
The test predicate, as stated by the task, is to determine if a string is collapsible,   and then, if so, collapse the string.   This requirement was met by all of the computer programming language entries, albeit some entries chose to add additional information,   but this was not part of the task's requirement.   Because of this, there doesn't need to be a separate test predicate.   I don't believe that there are defects in the test set   (I believe the test set of the five examples is adequate, adding any more would mean that all computer programming entries would have to be changed).   But if another test case (or cases) were added, it would mean all computer programming entries would need to be changed).   The task's requirements were written this way so that the programmer could/would choose the method of determination if a string is collapsible (or not),   and return the collapsed string   (or the unchanged string).   Nothing was mentioned that the calling program code has to be notified   (and indeed, some programming examples have the calling program do the determination and notification),   only that a string was to be returned,   either a collapsed string or the original string.   I intended that the programmer choose to use (or not use) any manner of predicate testing.   The need for a predicate test wasn't specifically required or requested, so there is no need for a separate test   (as it wasn't mentioned in the task's requirements).   If there is no requirement for a predicate test, there is no need to state its advantages or merits, but the programmer can choose to use a predicate test if they so desire if they wanted to implement a faster or more efficient version of a predicate test.     -- Gerard Schildberger (talk) 10:15, 25 June 2020 (UTC)
The solutions do not determine if the string is collapsible. If a task were to determine if a is less than a+5 printing the two values out and leaving me to determine by examining the printout is not the task determining if a is less then a+5. The solutions as are collapse the input and printout both strings. I can determine if collapsing has occurred by examining the two printed strings, but the tasks have not done so.--Nigel Galloway (talk) 15:50, 25 June 2020 (UTC)