fn gcd(a: Scalar, b: Scalar) -> Scalar =
  if b == 0
    then abs(a)
    else gcd(b, mod(a, b))

assert_eq(gcd(1071, 462), 21)
assert_eq(gcd(6, 35), 1)

assert_eq(gcd(-8, 4), 4)
assert_eq(gcd(-8, -4), 4)
assert_eq(gcd(8, -4), 4)
