- or download this
# step 1
sub binary {
...
#step 4
return $E . $b;
}
- or download this
# step 1
sub binary ($n) {
...
#step 4
return $E ~ $b;
}
- or download this
sub binary (0|1 $n) { $n }
...
my $E = binary($k);
return $E ~ $b;
}
- or download this
sub binary (Int where { $_ < 0 } $n)
{
my $E= binary(-$n);
return "-" ~ $E;
}
- or download this
subset NegativeInt of Int where { $_ < 0 } # I decided to declare it a
+fter all
subset PositiveInt of Int where { $_ > 0 }
...
return "-" ~ binary(-$n);
}
}
- or download this
PRE { !defined($wordsize) || frac($wordsize)==0 }