def horner

bend-collections-laws-crypto@1.0.0.0 · proofs/crypto/poly1305/poly.bend:16

import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/poly1305/poly.bend as Poly
import Base
import bend-collections-laws-crypto@1.0.0.0/spec/crypto/poly1305.bend as R

16# Horner's rule without reduction.
17def horner(bs: List<&2, List<&2, U32>>, +r: Nat, a: Nat) -> Nat:
18  match bs:
19    case Nil{}: a
20    case b <> rest: horner(rest, r, Nat.mul(r, Nat.add(a, R.coeff(b))))

Uses (6)

Used by (4)