Bin given limits: Difference between revisions

m
→‎{{header|REXX}}: simplified some code.
m (Reordered submissions alphabetically.)
m (→‎{{header|REXX}}: simplified some code.)
Line 300:
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 the bin counter. */
end /*k*/
!.k= !.k + 1 !.k= !.k + 1 /*a number is larger than any bin lim. limit*/
end /*j*/; return
/*──────────────────────────────────────────────────────────────────────────────────────*/
show: say center(' 'arg(1)" ", 5051 ); pad$= left('', 9) /*PAD$: for indentation.*/
say center('' , 5051, "═") /*show title separator. */
jp= #-1; ge= '≥'; eq= ' count='
do j=0 for #; jm= j - 1; idx= right(@.j, wb); cnt= right(!.j, wc)
if j==0 then say pad$ left('', length(ge) +1+wb+2+length(..) )"<" idx eq cntright(!.j,wc)
else say pad$ ge right(@.jm, wb) .. "<" idx eq cntright(!.j,wc)
if j==jp then say pad$ ge right(@.jmjp, wb) left('', 3 + length(..) + wb) eq cntright(!.#,wc)
end /*j*/
jm= j -end 1; /*j*/; cnt= right(!.j, wc)return</lang>
say pad ge right(@.jm, wb) left('', 3 + length(..) + wb) eq cnt
return</lang>
{{out|output|text=&nbsp; when using the internal default input:}}
<pre>
the 1st set of bin counts for the specified data:
═══════════════════════════════════════════════════
══════════════════════════════════════════════════
< 23 count= 11
≥ 23 .. < 37 count= 4
≥ 37 .. < 43 count= 2
≥ 43 .. < 53 count= 6
≥ 53 .. < 67 count= 9
≥ 67 .. < 83 count= 5
≥ 83 count= 13
 
 
 
the 2nd set of bin counts for the specified data:
═══════════════════════════════════════════════════
══════════════════════════════════════════════════
< 14 count= 3
≥ 14 .. < 18 count= 0
≥ 18 .. < 249 count= 44
≥ 249 .. < 312 count= 10
≥ 312 .. < 389 count= 16
≥ 389 .. < 392 count= 2
≥ 392 .. < 513 count= 28
≥ 513 .. < 591 count= 16
≥ 591 .. < 634 count= 6
≥ 634 .. < 720 count= 16
≥ 720 count= 59
</pre>