Skip to main content

encode

Function encode 

Source
pub fn encode<T>(
    bases: &[T],
    values: &[T],
    residue: impl Fn(&T, &T) -> T,
) -> Vec<T>
where T: Clone + NumAssignRef,
Expand description

The digits of each of values in the mixed radix of bases, as APL’s ⊤ gives them: each value’s digits together, the most significant first. residue(b, v) is v’s residue by the base b, which for a base of 0 is v, so a base of 0 takes all of what remains as its digit. integer::encode gives i64s, checked for overflow.