On Thu, Nov 14, 2002 at 11:02:02AM -0600, Jonathan Scott Duff wrote:
> Now, it would be nice to have a subroutine that, given a number, could
> output in any arbitrary base. Perhaps Perl6 could have a radix()
> subroutine that returns a string representation thusly:
> 
>       $base = 2;
>       $number = 13;
>       print radix($base,$number), "\n";       # outputs 1101
> 
> maybe even with an optional padding so that the above example could be
> output as "00001101".
> 

Perhaps we're just looking at a new printf() format string - %r?
Specifying radix AND padding AND accuracy might be ugly...
"%${rad}.${pad}.${acc}r"?

J

Reply via email to