September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -1,10 +1,10 @@
func floyd(rows, n=1) {
var max = Math.range_sum(1, rows);
var widths = (max-rows .. max-1 -> map{(.+n).to_s.len});
var max = Math.range_sum(1, rows)
var widths = (max-rows .. max-1 -> map{.+n->to_s.len})
{ |r|
say %'#{1..r -> map{|i| "%#{widths[i-1]}d" % n++}.join(" ")}';
} * rows;
say %'#{1..r -> map{|i| "%#{widths[i-1]}d" % n++}.join(" ")}'
} << 1..rows
}
floyd(5); # or: floyd(5, 88);
floyd(14); # or: floyd(14, 900);
floyd(5) # or: floyd(5, 88)
floyd(14) # or: floyd(14, 900)