package overload;
+$overload::hint_bits = 0x20000;
+
sub nil {}
sub OVERLOAD {
%ops = ( with_assign => "+ - * / % ** << >> x .",
assign => "+= -= *= /= %= **= <<= >>= x= .=",
- str_comparison => "< <= > >= == !=",
+ num_comparison => "< <= > >= == !=",
'3way_comparison'=> "<=> cmp",
- num_comparison => "lt le gt ge eq ne",
+ str_comparison => "lt le gt ge eq ne",
binary => "& | ^",
unary => "neg ! ~",
mutators => '++ --',
# Arguments: what, sub
while (@_) {
$^H{$_[0]} = $_[1];
- $^H |= $constants{$_[0]} | 0x20000;
+ $^H |= $constants{$_[0]} | $overload::hint_bits;
shift, shift;
}
}
with_assign => '+ - * / % ** << >> x .',
assign => '+= -= *= /= %= **= <<= >>= x= .=',
- str_comparison => '< <= > >= == !=',
+ num_comparison => '< <= > >= == !=',
'3way_comparison'=> '<=> cmp',
- num_comparison => 'lt le gt ge eq ne',
+ str_comparison => 'lt le gt ge eq ne',
binary => '& | ^',
unary => 'neg ! ~',
mutators => '++ --',
my $iter = 1; # 2**($iter+2) = 8
my $side = new symbolic 1;
my $cnt = $iter;
-
+
while ($cnt--) {
$side = (sqrt(1 + $side**2) - 1)/$side;
}
my $iter = new symbolic 2; # 16-gon
my $side = new symbolic 1;
my $cnt = $iter;
-
+
while ($cnt) {
$cnt = $cnt - 1; # Mutator `--' not implemented
$side = (sqrt(1 + $side**2) - 1)/$side;