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 a = i/ l aq; let b = i/ l bq; i* aq a; i+ (i* ap a) (i* bp b); }; 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; }; }