Range extraction: Difference between revisions
Content deleted Content added
m →{{header|REXX}}: optimized and simplified versions 1a and 1b. |
→{{header|REXX}}: elided REXX version 1a, it was slower and more complicated. |
||
Line 4,612:
=={{header|REXX}}==
Note that the two numbers '''11''' and '''12''' are not considered a range.
===version
This REXX version isn't limited to integers. It doesn't need a magic number to terminate the list.
<lang rexx>/*REXX program creates a range extraction from a list of numbers (can be negative.) */
Line 4,635:
new: 0-2,4,6-8,11,12,14-25,27-33,35-39
</pre>
<!-- elided version 1a as it was slower and less idiomatic.
===version
The REXX version is the same as above, but doesn't modify a '''do''' loop's index ('''j'''),
<br>and it also doesn't need a magic number to terminate the list.
Line 4,656:
say 'old:' old; say 'new:' new /*show the old and new range of numbers*/</lang>
{{out|output|text= is the same as the 1<sup>st</sup> REXX version (1a).}}<br><br>
!-->
===version 2===
|