Undigits.jl
This package provides undigits, the reverse of digits.
julia> undigits([2, 4])
42
julia> undigits([2, 4]; rev=true)
24
julia> undigits(UInt8, [1, 0, 1, 1]; base=2)
0x0d
julia> n = UInt16(17); undigits(typeof(n), digits(n)) === n
true
I wanted this today and could not recall which overly-ambitious package I had stuck it in. I even thought it might be in Undigits.jl, so I searched.
I found it and put it in a standalone package. I have not made a registration request.
1 Like
mbauman
2
It’s not very intuitive (and doesn’t catch overflow), but you can also spell this evalpoly(base, digits).
2 Likes
I forgot about that issue. evalpoly(base, v) is probably not too hard to think of if you use Julia frequently. It’s certainly economical.
Looking at the issue again, I see that this package
FromDigits.jl
exists.