June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -3,9 +3,9 @@ parse arg N .; if N=='' | N=="," then N=5 /*Not specified? Then use the
mx=N * (N+1) % 2 - N /*calculate maximum value of any value.*/
say 'displaying a ' N " row Floyd's triangle:" /*show the header for Floyd's triangle.*/
say
#=1; do r=1 for N; i=0; _= /*construct Floyd's triangle row by row*/
do #=# for r; i=i+1 /*start to construct a row of triangle.*/
_=_ right(#, length( mx+i ) ) /*build a row of the Floyd's triangle. */
#=1; do r=1 for N; i=0; _= /*construct Floyd's triangle row by row*/
do #=# for r; i=i+1 /*start to construct a row of triangle.*/
_=_ right(#, length( mx+i ) ) /*build a row of the Floyd's triangle. */
end /*#*/
say substr(_, 2) /*remove 1st leading blank in the line.*/
end /*r*/ /*stick a fork in it, we're all done. */

View file

@ -3,8 +3,8 @@ parse arg N .; if N=='' | N=="," then N=6 /*Not specified? Then use the
mx=N * (N+1) % 2 - N /*calculate maximum value of any value.*/
say 'displaying a ' N " row Floyd's triangle in base 16:" /*show triangle header.*/
say
#=1; do r=1 for N; i=0; _= /*construct Floyd's triangle row by row*/
do #=# for r; i=i+1 /*start to construct a row of triangle.*/
#=1; do r=1 for N; i=0; _= /*construct Floyd's triangle row by row*/
do #=# for r; i=i+1 /*start to construct a row of triangle.*/
_=_ right( d2x(#), length( d2x(mx+i))) /*build a row of the Floyd's triangle. */
end /*#*/
say substr(_, 2) /*remove 1st leading blank in the line.*/

View file

@ -5,12 +5,12 @@ if radx=='' | radx=="," then radx=10 /* " " " " "
mx=N * (N+1) % 2 - N /*calculate maximum value of any value.*/
say 'displaying a ' N " row Floyd's triangle in base" radx':' /*display the header.*/
say
#=1; do r=1 for N; i=0; _= /*construct Floyd's triangle row by row*/
do #=# for r; i=i+1 /*start to construct a row of triangle.*/
#=1; do r=1 for N; i=0; _= /*construct Floyd's triangle row by row*/
do #=# for r; i=i+1 /*start to construct a row of triangle.*/
_=_ right(base(#, radx), length( base(mx+i, radx) ) ) /*build triangle row.*/
end /*#*/
say substr(_, 2) /*remove 1st leading blank in the line,*/
end /*r*/ /* [↑] introduced by first abutment. */
say substr(_, 2) /*remove 1st leading blank in the line,*/
end /*r*/ /* [↑] introduced by first abutment. */
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
base: procedure; parse arg x 1 ox,toB,inB /*obtain number, toBase, inBase. */