def strip_go

bend-collections-laws-crypto@1.0.0.0 · src/math/generic.bend:217

import bend-collections-laws-crypto@1.0.0.0/src/math/generic.bend as Generic
import Base
import bend-collections-laws-crypto@1.0.0.0/src/math/num.bend as N

217# x with its factors of two removed (x != 0)
218def strip_go(~T: Data, ~op: N.Op<T> -> T, ~test: N.Test<T> -> Bool, fuel: Nat, st: T & Bool) -> T:
219  match fuel st:
220    case 0n Tuple{x, o}:
221      x
222    case 1n+f Tuple{x, True{}}:
223      x
224    case 1n+f Tuple{+x, False{}}:
225      strip_go(~T, ~op, ~test, f, hst(~T, ~op, ~test, x))

Uses (7)

Used by (1)