Continued fraction/Arithmetic/Construct from rational number: Difference between revisions
Continued fraction/Arithmetic/Construct from rational number (view source)
Revision as of 14:52, 1 March 2023
, 1 year ago→An implementation using lazy lists
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.
|