Larry Wall wrote:
So we should probably
have a generalized radix_to_dec($radix,$input) function out there
somewhere instead.

Why not shift it onto the type system:

my Int $i = $input as Str[$radix] as Int;

A bit lengthy but quite clear.
And easy to extend e.g. to roman numerals:

say "VII" as Str[Roman] as Int; # prints 7

Of course then we need

class Str[ uint $radix where { $radix > 1 } ]
class Str[ ::T does StringNumification ]

But for literals and input values with a fixed radix, I kinda like
the : notation.

Yes, it's cool and very general! -- TSa (Thomas Sandla▀)

Reply via email to