Talk:Strip a set of characters from a string: Difference between revisions

From Rosetta Code
Content added Content deleted
(→‎REXX version 3: pasted rexx discussion - may need clean-up. Please don't put discussion on task page, thanks.)
(→‎REXX version 3: added a comment about the REXX language "definition". -- ~~~~)
Line 9: Line 9:
==REXX version 3==
==REXX version 3==
::: ''I have noted the restriction. What's the problem with CR and LF and tab ???'' --[[User:Walterpachl|Walterpachl]] ([[User talk:Walterpachl|talk]]) 22:33, 7 June 2013 (UTC)
::: ''I have noted the restriction. What's the problem with CR and LF and tab ???'' --[[User:Walterpachl|Walterpachl]] ([[User talk:Walterpachl|talk]]) 22:33, 7 June 2013 (UTC)

:::: You've noted '''a''' restriction (which isn't checked for; if the any of the restrictions exist, the program produces the wrong result --- if this version is inferior to a previous version, it should be corrected or removed, in my opinion).   The problem with other whitespace is that the '''space''' bif removes them (because they are considered blanks).   Change the period (within the string) to a period followed by six tab characters and note the result(s). -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 23:01, 7 June 2013 (UTC)
:::: You've noted '''a''' restriction (which isn't checked for; if the any of the restrictions exist, the program produces the wrong result --- if this version is inferior to a previous version, it should be corrected or removed, in my opinion).   The problem with other whitespace is that the '''space''' bif removes them (because they are considered blanks).   Change the period (within the string) to a period followed by six tab characters and note the result(s). -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 23:01, 7 June 2013 (UTC)

:::::: Which REXX would do that? Mine (ooRexx) does not! s='a'||'05'x||b;t=space(s,0);say t c2x(t) And there should be room for simpler, albeit restricted, solutions. --[[User:Walterpachl|Walterpachl]] ([[User talk:Walterpachl|talk]]) 05:49, 8 June 2013 (UTC)
:::::: Which REXX would do that? Mine (ooRexx) does not! s='a'||'05'x||b;t=space(s,0);say t c2x(t) And there should be room for simpler, albeit restricted, solutions. --[[User:Walterpachl|Walterpachl]] ([[User talk:Walterpachl|talk]]) 05:49, 8 June 2013 (UTC)


::::::: Regina REXX's doc says it does (but doesn't --- I've considered submitting a bug, but I don't believe that's the correct behavior as it may break older programs --- this was a topic of heated debate a decade earlier or so); ROO and R4 do (I haven't test a multitude of others).   Note that (in some REXXes) whitespace is/are blanks, and blanks are spaces and several other characters such as tabs, VT, HT, LF, CR, etc.   The list of which characters are considered blanks is rather vague and comprehensive.   Older REXX interpreters only use the space character.   This most likely includes CMS REXX and TSO REXX, oRexx, the CMS and TSO REXX compiler, and apparently ooRexx.
::::::: Regina REXX's doc says it does (but doesn't --- I've considered submitting a bug, but I don't believe that's the correct behavior as it may break older programs --- this was a topic of heated debate a decade earlier or so); ROO and R4 do (I haven't test a multitude of others).   Note that (in some REXXes) whitespace is/are blanks, and blanks are spaces and several other characters such as tabs, VT, HT, LF, CR, etc.   The list of which characters are considered blanks is rather vague and comprehensive.   Older REXX interpreters only use the space character.   This most likely includes CMS REXX and TSO REXX, oRexx, the CMS and TSO REXX compiler, and apparently ooRexx.

::::::::: I'd say the language is rather strict about the SPACE builtin-function. White space in Rexx source code is a different matter. --[[User:Walterpachl|Walterpachl]] ([[User talk:Walterpachl|talk]]) 09:35, 8 June 2013 (UTC). Afterthought: How does Strip behave in REXXes that I do not have? You mention blank in your version 1 of this task's solutions.
::::::::: I'd say the language is rather strict about the SPACE builtin-function. White space in Rexx source code is a different matter. --[[User:Walterpachl|Walterpachl]] ([[User talk:Walterpachl|talk]]) 09:35, 8 June 2013 (UTC). Afterthought: How does Strip behave in REXXes that I do not have? You mention blank in your version 1 of this task's solutions.

:::::::::: You say ''the language'', but that is ambiguous.   It depends what definition is being used for the implementation.   I always preferred IBM's documents for Classic REXX (CMS and TSO REXX reference) as they are clean, concise, and consistent).   Regina REXX's documentation is incomplete, has conflicting information, many terms aren't defined.   The Regina PDF documentation states that the document is to provide an overview of the REXX Language and the Regina implementation of the REXX Language.   It is not intended as a definitive reference to REXX; you should really have a copy of the REXX "bible"; ''The REXX Language,'' by ''Mike Colwishaw'' [TRL2].   There seems to be a lot of conflicts between the two documents. -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 00:09, 9 June 2013 (UTC)

<br><br>The following is a simplier albeit restricted version of a REXX program elsewhere on Rosetta Code:
<br><br>The following is a simplier albeit restricted version of a REXX program elsewhere on Rosetta Code:
<lang rexx>/*REXX program gets two numbers and show their sum.*/
<lang rexx>/*REXX program gets two numbers and show their sum.*/
Line 22: Line 28:
<br><br>
<br><br>
:: I beg to differ and let's leave it at that, please! --[[User:Walterpachl|Walterpachl]] ([[User talk:Walterpachl|talk]]) 09:35, 8 June 2013 (UTC)
:: I beg to differ and let's leave it at that, please! --[[User:Walterpachl|Walterpachl]] ([[User talk:Walterpachl|talk]]) 09:35, 8 June 2013 (UTC)

Since the task asks for character stripping we can do without '''changestr'''.
If the solution doesn't solve the task as per the requirements, then at the least, it should be fixed. &nbsp; Just noting the restriction (as noted above in the three line example) doesn't make it correct.

<br>Since the task asks for character stripping we can do without '''changestr'''.
<br>(Only if you accept that it only works under certain conditions.)
<br>(Only if you accept that it only works under certain conditions.)

Revision as of 00:09, 9 June 2013

Task clarification

I assume from the example, that the case is be be preserved, and the characters to be removed are also case sensative. It wouldn't hurt to mention that uppercase characters for the AEI are to be left intact. -- Gerard Schildberger 18:44, 9 June 2012 (UTC)

It seems to be implied by omission. Why change case unless told to? --Paddy3118 20:51, 9 June 2012 (UTC)
I didn't change case, I preserved it. But some people think that a character may be the same as a letter, and that's ambigous, letters can be upper or lowercase. It still doesn't hurt to state that. I realize that one can assume a lot from omissions, but not necessarily correct assumptions. It's only obvious to the person writing (er, not writing) the omissions. If the example wasn't shown, I would've assume strip meant to remove any outer characters, not inner characters. A lot of people have many assumptions about the words used, especially those languages which have a strip bif. -- Gerard Schildberger 20:56, 9 June 2012 (UTC)

REXX version 3

I have noted the restriction. What's the problem with CR and LF and tab ??? --Walterpachl (talk) 22:33, 7 June 2013 (UTC)
You've noted a restriction (which isn't checked for; if the any of the restrictions exist, the program produces the wrong result --- if this version is inferior to a previous version, it should be corrected or removed, in my opinion).   The problem with other whitespace is that the space bif removes them (because they are considered blanks).   Change the period (within the string) to a period followed by six tab characters and note the result(s). -- Gerard Schildberger (talk) 23:01, 7 June 2013 (UTC)
Which REXX would do that? Mine (ooRexx) does not! s='a'||'05'x||b;t=space(s,0);say t c2x(t) And there should be room for simpler, albeit restricted, solutions. --Walterpachl (talk) 05:49, 8 June 2013 (UTC)
Regina REXX's doc says it does (but doesn't --- I've considered submitting a bug, but I don't believe that's the correct behavior as it may break older programs --- this was a topic of heated debate a decade earlier or so); ROO and R4 do (I haven't test a multitude of others).   Note that (in some REXXes) whitespace is/are blanks, and blanks are spaces and several other characters such as tabs, VT, HT, LF, CR, etc.   The list of which characters are considered blanks is rather vague and comprehensive.   Older REXX interpreters only use the space character.   This most likely includes CMS REXX and TSO REXX, oRexx, the CMS and TSO REXX compiler, and apparently ooRexx.
I'd say the language is rather strict about the SPACE builtin-function. White space in Rexx source code is a different matter. --Walterpachl (talk) 09:35, 8 June 2013 (UTC). Afterthought: How does Strip behave in REXXes that I do not have? You mention blank in your version 1 of this task's solutions.
You say the language, but that is ambiguous.   It depends what definition is being used for the implementation.   I always preferred IBM's documents for Classic REXX (CMS and TSO REXX reference) as they are clean, concise, and consistent).   Regina REXX's documentation is incomplete, has conflicting information, many terms aren't defined.   The Regina PDF documentation states that the document is to provide an overview of the REXX Language and the Regina implementation of the REXX Language.   It is not intended as a definitive reference to REXX; you should really have a copy of the REXX "bible"; The REXX Language, by Mike Colwishaw [TRL2].   There seems to be a lot of conflicts between the two documents. -- Gerard Schildberger (talk) 00:09, 9 June 2013 (UTC)



The following is a simplier albeit restricted version of a REXX program elsewhere on Rosetta Code: <lang rexx>/*REXX program gets two numbers and show their sum.*/ /*If y is zero, this works.*/ pull x y say x</lang> Just because it's simpler (with restrictions) doesn't means it warrants inclusion. -- Gerard Schildberger (talk) 08:50, 8 June 2013 (UTC)

I beg to differ and let's leave it at that, please! --Walterpachl (talk) 09:35, 8 June 2013 (UTC)

If the solution doesn't solve the task as per the requirements, then at the least, it should be fixed.   Just noting the restriction (as noted above in the three line example) doesn't make it correct.


Since the task asks for character stripping we can do without changestr.
(Only if you accept that it only works under certain conditions.)