Anonymous user
Ordered partitions: Difference between revisions
m
→{{header|REXX}}: changed comments and added whitespace.
m (→{{header|REXX}}: changed comments and added whitespace.) |
|||
Line 1,770:
end /*i*/ /* [↑] may have an omitted argument. */
/* [↓] process each of the arguments. */
do j=1 for #; _= arg(j)
len.j=max(1, _) /*LEN: length of args, 0=special. */
bot.j=left(d, _); if _==0 then bot.j=0 /*define the bottom number. */
Line 1,779:
end /*j*/
okD=left(0 || d, t + 1)
say center(' partitions for: ' hdr" ", 60, '─') /*display centered title for the output*/
say
do g=low to high /* [↑] generate the ordered partitions*/
if verify(g, okD) \==0 then iterate
p=1 /*P: is the position of a decimal dig.*/
$= /*$: will be the transformed numbers. */
do k=1 for #; _=substr(g, p,
if verify(_, @.k) \==0 then iterate g /*is the decimal digit not valid ?
!= /* [↓] validate the decimal number. */
if @.k\==0 then do j=1 for length(_); z=substr(_, j, 1)
Line 1,799 ⟶ 1,797:
end /*j*/
p=p + len.k /*point to the next decimal number. */
$=$ ' {'strip( translate(!, ,0), ,",")'}' /*dress number up by
end /*k*/
say left('', 18) $
end /*g*/
say
|