Re: [Scheme-reports] Formal Comment: R7RS 'eqv?' cannot be used for reliable memoization Mark H Weaver (21 Nov 2012 07:50 UTC)

Re: [Scheme-reports] Formal Comment: R7RS 'eqv?' cannot be used for reliable memoization Mark H Weaver 21 Nov 2012 07:43 UTC

John Cowan <cowan@mercury.ccil.org> 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@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports