def mul_by
import bend-collections-laws-math@1.0.0.0/src/math/generic.bend as Genericimport Base
import bend-collections-laws-math@1.0.0.0/src/math/num.bend as N
438# (acc * x, still fits)
439def mul_by(~T: Data, ~op: N.Op<T> -> T, ~test: N.Test<T> -> Bool, +x: T, st: T & Bool) -> T & Bool:
440 match st:
441 case Tuple{+a, +aok}:
442 (op(N.Mul{a, x}), Bool.and(aok, Bool.not(test(N.MulOver{a, x}))))