def add

bend-collections-laws-crypto@1.0.0.0 · spec/crypto/aes/poly.bend:8

import bend-collections-laws-crypto@1.0.0.0/spec/crypto/aes/poly.bend as Poly
import Base

8# Coefficient-wise sum (XOR); the longer tail is kept.
9def add(a: List<&2, Bool>, b: List<&2, Bool>) -> List<&2, Bool>:
10  match a b:
11    case Nil{} _:
12      b
13    case x <> xs Nil{}:
14      x <> xs
15    case x <> xs y <> ys:
16      Bool.xor(x, y) <> add(xs, ys)

Uses (3)

Used by (3)