Continued fraction/Arithmetic/Construct from rational number: Difference between revisions

Line 639:
===A practical implementation===
 
This example solution was written specifically with the idea of providing a general representation of possibly infinitely long continued fractions. Terms can be obtained arbitrarily, by their indices. One obtains '''Some term''' if the term is finite, or '''None()''' if the term is infinite.
 
One drawback is that, because a continued fraction is memoized, it may need to be updated. Therefore it must be stored in a mutable location, such as a '''var'''.
1,448

edits