-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Labels
featureIndicates new feature / enhancement requestsIndicates new feature / enhancement requests
Description
We have the digits function for integer -> digits:
julia> digits(1234)
4-element Vector{Int64}:
4
3
2
1However, we don't have the "inverse function" that implements digits -> integer. A top of the head implementation (ignoring base and pad keyword arguments) could be something like (cc: @ararslan)
digits2integer(digits) = sum(((i, x),) -> x * 10^(i - 1), pairs(digits))(Very ugly alternative: parse(Int, join(digits)))
such that
julia> digits2integer(digits(1234))
1234I feel we should have something like this, what do you think?
Potentially issues/difficulties:
- Type stability: what if the digits don't fit into
Int. We would need to dynamically extend toBigIntor similar which is obviously suboptimal. - Need to find a good name (as always).
- More?
Metadata
Metadata
Assignees
Labels
featureIndicates new feature / enhancement requestsIndicates new feature / enhancement requests