Re: Re: Function memoization
Florent Georges <[email protected]>
| Newsgroups | gmane.text.xml.xslt.extensions |
|---|---|
| Message-ID | <[email protected]> |
Frans Englich wrote:
> Perhaps it's better to simply map it into a call to
> fn:deep-equal()? Seems to simply spec'ing it.
IMHO, it is the wrong way, for two reasons:
- identity preserve more properties (at least the
identity itself), so the developer doesn't have to
bother because some property is not preserved (with
the counterpart that, in some cases, more memoized
values will be recorded, when identity is not
relevant);
- identity is tested fast (in the worst case scenario,
it is O(n) where n is the number of memoized values,
when no special search is performed, while deep-equal
is O(n*s), where s is the size of the values).
But as Colin pointed, it is not possible to test identity
on atomic items. But for them, IMHO, equality is the right
choice.
Regards,
--drkm
___________________________________________________________________________
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
http://fr.mail.yahoo.com