def madd
import bendtorch@1.3.0.0/spec.bend as Specimport Base
80# row-wise sum of two matrices (the shorter counts as padded)
81def madd(a: List<&2, List<&2, Nat>>, b: List<&2, List<&2, Nat>>) -> List<&2, List<&2, Nat>>:
82 match a b:
83 case Nil{} _:
84 b
85 case Con{r, rt} Nil{}:
86 Con{r, rt}
87 case Con{r, rt} Con{s, st}:
88 vadd(r, s) <> madd(rt, st)