def lmul
import bend-collections-laws-crypto@1.0.0.0/spec/crypto/secp256k1/curve.bend as Curveimport Base
142# left-to-right double-and-add: for each bit b, R = 2 R, then R = R + A
143# when b is set
144def lmul(+p: Nat, bs: List<&2, Nat>, +a: SPoint, r: SPoint) -> SPoint:
145 match bs:
146 case Nil{}: r
147 case b <> t: lmul(p, t, a, step(b, p, a, pdbl(p, r)))