Nimber arithmetic: Difference between revisions

m
→‎{{header|REXX}}: simplified some code.
m (→‎{{header|REXX}}: simplified some code.)
m (→‎{{header|REXX}}: simplified some code.)
Line 1,537:
if bb=='' | bb=="," then bb= 42689 /* " " " " " " */
w= max(4,length(sz)); @.= '+'; @.1= "*"; _= '═' /*calculate the width of the table cols*/
!= '║'; sz1= sz + 1; w1= w-1 /*define the "dash" character for table*/
do am=0 for 2 /*perform sums, then perform multiplies*/
call top ! || center("("@.am')', do j=0 for sz1 w1) /*calculateshow &title formatof atable. row of the table*/
ifdo j==0 thenfor callsz1; top$= '║'!||center("("@.am')'j, w1)! /*calculate & format a /*show titlerow of the table. */
$= '║'center(j, w1)"║" /*index for a table row.*/
do k=0 for sz1 /*build a row of table. */
if am then $= $ || right( nprod(j, k), w) /*append to a table row.*/
else $= $ || right( nsum(j, k), w) /* " " " " " */
end /*k*/
say $ '║'! /*show a row of a table.*/
end /*j*/
call bot
Line 1,555 ⟶ 1,554:
exit 0 /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
hdr: $= ?'║' || !; do i=0 to sz; $=$ || right(i,w); end; say $ "║"!; call sep; return
top: $= '╔'copies(_, w1)"╦"copies(copies(_, w), sz1)_; say $'╗'; arg ?; call hdr; return
sep: $= '╠'copies(_, w1)"╬"copies(copies(_, w), sz1)_; say $'╣'; return