- or download this
sub min {(sort {$a<=>$b} @_ )[0];}
sub max {(sort {$a<=>$b} @_ )[-1];}
- or download this
sub min_max {
my( $min, $max ) = ( 1e-308, 1e308 );
...
}
return ($min, $max);
}
- or download this
#! perl -slw
use strict;
...
plotxy($turtle->(), 'dragon.jpg', 2);
- or download this
$xy->[0] += $dist*sin(PI*$dir/180);
$xy->[1] += $dist*cos(PI*$dir/180);
- or download this
my %sin_d; sub sin_d{ my $d=shift; $sin_d{$d} || ( $sin_d{$d} = sin(PI
+*$d/180) ); }
my %cos_d; sub cos_d{ my $d=shift; $cos_d{$d} || ( $cos_d{$d} = cos(PI
+*$d/180) ); }
...
$xy->[0] += $dist * sin_d($dir);
$xy->[1] += $dist * cos_d($dir);
...