Jump to content

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

m
Line 293:
=={{header|ATS}}==
 
I found the reference to "lazy evaluation" misleading, for it implies a special feature of a programming language. Haskell, for example, evaluates lists "lazily". ATS2ATS has the notation '''$delay''', and there are various "lazy list" implementations for Scheme. I considered using such methods, but decided against doing so.
 
What one is--I am certain--supposed to write is means for generating an arbitrary number of terms of a continued fraction, one term after another. It happens that, for a rational number, eventually all further terms are known to be swamped by an infinity, and so need not be computed. The finite terms ''could'' be returned as a finite-length list. However, this will not be so when irrational numbers enter the picture. Therefore one needs a way to generate ''an indefinite number'' of terms. But this is something that requires no "lazy" features of a language. It could be done easily in standard C! The resulting code might, indeed, evaluate terms "lazily", but no special language features are required.
1,448

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.