def vadd
import bendtorch@1.3.0.0/spec.bend as Specimport Base
19# vector sum; the shorter vector counts as padded with zeros
20def vadd(xs: List<&2, Nat>, ys: List<&2, Nat>) -> List<&2, Nat>:
21 match xs ys:
22 case Nil{} _:
23 ys
24 case Con{x, xt} Nil{}:
25 Con{x, xt}
26 case Con{x, xt} Con{y, yt}:
27 Nat.add(x, y) <> vadd(xt, yt)