Generic.gcd_go: def of bend-collections-laws-math@1.0.0.0 Import: import bend-collections-laws-math@1.0.0.0/src/math/generic.bend as Generic Lines 200-208 of bend-collections-laws-math@1.0.0.0/src/math/generic.bend: https://jend.leeeet.dev/read.txt?path=bend-collections-laws-math@1.0.0.0/src/math/generic.bend&start_line=200&end_line=208 import Base import bend-collections-laws-math@1.0.0.0/src/math/num.bend as N # Euclid's algorithm on (a, (b, b == 0)) def gcd_go(~T: Data, ~op: N.Op -> T, ~test: N.Test -> Bool, fuel: Nat, +a: T, st: T & Bool) -> T: match fuel st: case 0n _: a case 1n+f Tuple{b, True{}}: a case 1n+f Tuple{+b, False{}}: gcd_go(~T, ~op, ~test, f, b, zst(~T, ~test, op(N.Rem{a, b}))) Uses (7): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/src/math/generic.bend&name=zst https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/src/math/num.bend&name=Op https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/src/math/num.bend&name=Test