<div dir="ltr">Also: <a href="https://github.com/UlfNorell/agda-prelude/blob/master/src/Data/Rational.agda">https://github.com/UlfNorell/agda-prelude/blob/master/src/Data/Rational.agda</a><div><br></div><div>I maintain (statically) the invariant that numerator and denominator are coprime by doing a gcd for every operation, which of course affects performance. Everything is using primitive integer operations though so it's fast enough for practical applications, if not for high-performance situations.</div><div><br></div><div>/ Ulf</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 11, 2015 at 1:55 PM, Dr. ÉRDI Gergő <span dir="ltr"><<a href="mailto:gergo@erdi.hu" target="_blank">gergo@erdi.hu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">I hope this might be useful to someone as well: <a href="http://stackoverflow.com/questions/31212459/how-to-add-two-rational-in-agda/31265445#31265445" target="_blank">http://stackoverflow.com/questions/31212459/how-to-add-two-rational-in-agda/31265445#31265445</a></p><div class="HOEnZb"><div class="h5">
<div class="gmail_quote">On 11 Dec 2015 20:46, "Andreas Abel" <<a href="mailto:abela@chalmers.se" target="_blank">abela@chalmers.se</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Nicola Botta told me that he and Tim Richter both implemented rationals in Idris. See:<br>
<br>
<br>
<a href="https://github.com/nicolabotta/SeqDecProbs/blob/master/frameworks/14-/NonNegRationalProperties.lidr" rel="noreferrer" target="_blank">https://github.com/nicolabotta/SeqDecProbs/blob/master/frameworks/14-/NonNegRationalProperties.lidr</a><br>
<br>
<br>
<a href="https://github.com/nicolabotta/SeqDecProbs/blob/master/frameworks/14-/NonNegRational2.lidr" rel="noreferrer" target="_blank">https://github.com/nicolabotta/SeqDecProbs/blob/master/frameworks/14-/NonNegRational2.lidr</a><br>
<br>
It is not clear yet whether these implementations are efficient enough. I just post them as a reference in case someone makes a library for rationals in Agda.<br>
<br>
Cheers,<br>
Andreas<br>
<br>
-- <br>
Andreas Abel <>< Du bist der geliebte Mensch.<br>
<br>
Department of Computer Science and Engineering<br>
Chalmers and Gothenburg University, Sweden<br>
<br>
<a href="mailto:andreas.abel@gu.se" target="_blank">andreas.abel@gu.se</a><br>
<a href="http://www2.tcs.ifi.lmu.de/~abel/" rel="noreferrer" target="_blank">http://www2.tcs.ifi.lmu.de/~abel/</a><br>
_______________________________________________<br>
Agda mailing list<br>
<a href="mailto:Agda@lists.chalmers.se" target="_blank">Agda@lists.chalmers.se</a><br>
<a href="https://lists.chalmers.se/mailman/listinfo/agda" rel="noreferrer" target="_blank">https://lists.chalmers.se/mailman/listinfo/agda</a><br>
</blockquote></div>
</div></div><br>_______________________________________________<br>
Agda mailing list<br>
<a href="mailto:Agda@lists.chalmers.se">Agda@lists.chalmers.se</a><br>
<a href="https://lists.chalmers.se/mailman/listinfo/agda" rel="noreferrer" target="_blank">https://lists.chalmers.se/mailman/listinfo/agda</a><br>
<br></blockquote></div><br></div>