Anonymous user
First class environments: Difference between revisions
m
→{{header|REXX}}: added/changed whitespace and comments. added wording to the REXX section header.
(Added Wren) |
m (→{{header|REXX}}: added/changed whitespace and comments. added wording to the REXX section header.) |
||
Line 1,677:
<br>once a '''1''' (unity) is found, no more numbers are displayed in that column).
Column widths are automatically adjusted for their width (the maximum decimal digits displayed in a column).
The '''hailstone''' function (subroutine) could be coded
<br>the solution have a ''single piece of code to be run repeatedly in each of these environments''.
<lang rexx>/*REXX
parse arg
if
do i=1 for n; @.i= i /* " environments to an index. */
w= length(n) /*width (so far) for columnar output.*/
do forever until @.0;
do k=1 for
w= max(w, length(x)
@.k= @.k x
end /*k*/
end /*forever*/
#=
do lines=-1 until _=''; _= /*process a line for each environment. */
do j=1 for
select /*determine how to process the line. */
when #== 1 then _= _ right(words(@.j) - 1, w) /*environment count.*/
when lines==-1 then _= _ right(j, w)
when lines== 0 then _= _ right('', w, "─")
otherwise _= _ right(word(@.j, lines), w)
end /*select*/
end /*j*/
if
if
if
if _\='' then say strip( substr(_, 2), "T") /*display the counts*/
end /*lines*/
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
hailstone:
{{out|output|text= when using the default input:}}
(Shown at
<pre style="font-size:75%>
1 2 3 4 5 6 7 8 9 10 11 12
Line 1,744 ⟶ 1,746:
{{out|output|text= when using the input of: <tt> 60 </tt>}}
(Shown at
<pre style="font-size:67%;height:185ex">
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|