def big.mul.add

yaml-for-bend@0.1.1.0 · num.bend:57

import yaml-for-bend@0.1.1.0/num.bend as Num
import Base

57# +ds+ times +base+, plus +carry+.
58def big.mul.add(ds: List<&2, Nat>, +base: Nat, carry: Nat) -> List<&2, Nat>:
59  match ds:
60    case Nil{}:
61      big.of.nat(carry)
62    case Con{d, rest}:
63      +x = Nat.add(Nat.mul(d, base), carry)
64      Nat.mod(x, 10n) <> big.mul.add(rest, base, Nat.div(x, 10n))

Uses (7)

Used by (2)