$ raku -e 'dd "g".parse-base(17)' 16
> On 30 Oct 2020, at 21:25, Sean McAfee <eef...@gmail.com> wrote: > > I want to construct a number from its digits in some arbitrary base. That > is, to essentially do the inverse of this kind of polymod call: > > my @digits = $number.polymod($base xx *); > > I have a nagging feeling that I've seen a very concise way to do this in Raku > before, but now it escapes me, and all my searching has found only pages > describing basic, ordinary base conversion. > > Obviously for bases from 2-10 one can just concatenate the digits and pass > them to a conversion construct like :2(...) or :5(...) or whatever, if the > base is fixed at compile time. For the more general case the best I can come > up with is > > my $number = sum @digits Z* (1, * * $base ... *); > > Is there a shorter and/or better way? >