Range extraction: Difference between revisions

→‎{{header|REXX}}: elided REXX version 1a, it was slower and more complicated.
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 1a1===
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 1b1a===
The REXX version is the same as above, but doesn't modify a &nbsp; '''do''' &nbsp; loop's index &nbsp; ('''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=&nbsp; is the same as the 1<sup>st</sup> REXX version (1a).}}<br><br>
!-->
 
===version 2===