def Mag.cmp
import bend-kit-bignum@0.1.0.0/bigint.bend as Bigintimport Base
110# Both canonical, so the longer one is larger.
111def Mag.cmp(a: List<&2, U32>, b: List<&2, U32>) -> Cmp:
112 match a b:
113 case Con{x, xs} Con{y, ys}:
114 Mag.then(Mag.cmp(xs, ys), U32.cmp(x, y))
115 case Nil{} Nil{}:
116 EQ{}
117 case Nil{} Con{y, ys}:
118 LT{}
119 case Con{x, xs} Nil{}:
120 GT{}