Original-Via: uk.ac.nsf; Tue, 5 Nov 91 21:21:39 GMT

| Date:    Fri, 25 Oct 91 12:12:35 +0000
| From:    Tony Davie <[EMAIL PROTECTED]>
| To:      haskell
| Subject: modules in the report
|
| 1: The functions 'approximants' and 'partialQuotients' are exported
| from module 'PreludeRatio' (see p94).
| Should they appear in Figure 9, p58 together
| with a description of what they do in section 6.8.3?

Perhaps I should explain why these functions are in the prelude at all.
Early on, we made a decision to provide the functionality of the
numerics of Scheme in Haskell.  Scheme has a function "rationalize",
which takes one argument and returns its rational equivalent or two
arguments, the second being a tolerance.  In this case, the result
is a rational number within the given tolerance of the value of the
first argument with as small a denominator as possible.  These
two versions of "rationalize" become "toRational" and "approxRational"
in Haskell.  A way to implement  approxRational  is to generate the
sequence of continued-fraction approximants and take the first
approximant within the tolerance (Well, almost--It's possible for the
first two approximants to have denominator 1, in which case, you want
the second one.)  The approximants are computed from the partial quotients,
which you get by running Euclid's algorithm.  I was told by an expert in
the field that both the approximants and the partial quotients are
generally useful in applications of number theory, so it would seem a
pity to define these functions and not export them.

Now, the short answer to the question above is, "Yes."  I'll see to the
changes to section 6.

| 2: The module 'PreludeComplex' (see p 96) only appears to export type 'Complex'
| and its constructor '(:+)'.  Things like realPart, imagPart ... don't seem
| to be exported. Am I misunderstanding this? Should the module declaration
| not read:
|
| module PreludeComplex(PreludeComplex..)
|
| or, more explicitly,
|
| module PreludeComplex( Complex((:+)), realPart, imagPart, conjugate, .... )

Yes.  This oversight resulted from an incomplete job of moving those
functions from Prelude to PreludeComplex.  I think the right fix is
just to change the module declaration to

        module PreludeComplex

(Everything is exported.)

Thanks, Tony.

--Joe

Reply via email to