Pentagram: Difference between revisions
→{{header|Perl 6}}: various simplifications
(→{{header|Perl 6}}: anonymous variables are stateful by default) |
(→{{header|Perl 6}}: various simplifications) |
||
Line 233:
<lang perl6>constant $dim = 200;
constant $sides = 5;
INIT say qq:to/STOP/;
<?xml version="1.0" standalone="no" ?>
Line 241:
STOP
END say '</svg>';
my @vertices = map { 0.9 * $dim * cis($_ * 2 * pi / $sides) }, ^$sides;
@vertices = map |*.reals, flat
say pline @vertices;
for @vertices.rotor(4 => -2, :partial) -> @p {say pline @p};
sub pline (*@q) {
qq:to/STOP/;
<polyline points="
style="fill:seashell;stroke:{<black red orange blue purple green>[$++ % 6]};stroke-width:2"
transform="translate($dim, $dim) rotate(180)" />
|