[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] Formal Comment: R7RS 'eqv?' cannot be used for reliable memoization



John Cowan <cowan@x> writes:

> Mark H Weaver scripsit:
>
>> What I want, indeed what I *require*, is the ability to memoize
>> procedures without having to worry that my code might produce the wrong
>> answers on some future implementation of R7RS.
>
> 1) So use a memoization comparison function that handles NaN, negative
> zero, and the infinities specially.

I could define a sane-eqv? that handles signed zeroes easily enough, but
even if I were content to assume a traditional floating-point
representation, I'm at a loss for how to compare the precisions and
exponent ranges in a reasonably efficient way.  Any suggestions?

Anyway, a more serious problem is that efficient memoization of
numerical procedures must be based on optimized equal?-based hash
tables, which presumably will be included in R7RS-large.

Unless R7RS-large provides optimized hash tables based on an 'equal?'
that differs from the one in R7RS-small (unlikely), the R7RS-large hash
tables will not be usable for reliable memoization either.

But it's abundantly clear that you don't care.

      Mark

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports