export { /* Implementation of Rational Numbers */ let ratio-scale = λ{ {p:ℕ; q:ℕ;} : ℚ ~ ; n : ℕ ~ machine.UInt64 ; } ↦ { i* q n; i* p n; }; let ratio-normalize = λ{ p: ℤ~machine.Int64; q: ℤ~machine.Int64; } : ℚ ~ ↦ { let s = gcd p q; i/ q s; i/ p s; }; let ratio-add = λ{ {ap:ℕ; aq:ℕ;}: ℚ ~ ; {bp:ℕ; bq:ℕ;}: ℚ ~ ; } ↦ { let l = lcm aq bq; let as = i/ l aq; let bs = i/ l bq; i* aq as; i+ (i* ap as) (i* bp bs); }; let ratio-mul = λ{ {ap:ℤ; aq:ℤ;}: ℚ ~ ; {bp:ℤ; bq:ℤ;}: ℚ ~ ; } ↦ ratio-normalize (i* ap bp) (i* aq bq); let fmt-ratio = λ{ p:ℤ; q:ℤ; }: ℚ~ ↦ { fmt-int q;':';fmt-int p; }; }