Anonymous user
Bin given limits: Difference between revisions
m
→{{header|REXX}}: simplified some code.
m (Correction to task description.) |
m (→{{header|REXX}}: simplified some code.) |
||
Line 553:
exit 0 /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
do j=1 for #; _= j - 1; @._= word(limList, j); wb= max(wb, length(@._) )▼
end /*j*/; return▼
/*──────────────────────────────────────────────────────────────────────────────────────*/▼
do j=1 for datum; x= word(nums, j)
do k=0 for # /*find the bin that this number is in. */
if x < @.k then do; !.k= !.k + 1; iterate j; end /*bump
end /*k*/
!.k= !.k + 1 /*
end /*j*/; return
▲/*──────────────────────────────────────────────────────────────────────────────────────*/
lims: parse arg limList; #= words(limList); wb= 0 /*max width binLim*/
▲ do j=1 for #; _= j - 1; @._= word(limList, j); wb= max(wb, length(@._) )
▲ end /*j*/; return
/*──────────────────────────────────────────────────────────────────────────────────────*/
show: parse arg t; say center(
jp= # - 1;
do j=0 for #; jm= j - 1;
if j==0 then say $ left('', length(ge) +
else say $ ge right(@.jm, wb) ..
if j==jp then say $ ge right(@.jp,
end /*j*/; return</lang>
{{out|output|text= when using the internal default input:}}
<pre>
|