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

Line 3,372:
 
This version has the advantage that it memoizes terms in a form that is efficient for sequential access.
 
''Important'': in Mercury, '''delay''' takes an explicit thunk (not a value implicitly enclosed in a thunk) as its argument. If you use '''val''' instead of '''delay''', you will get eager evaluation.
 
I used arbitrary-precision numbers so I could plug in some big numbers.
1,448

edits