Russ Allbery wrote:
> I'd really like to see a concrete example of a sane sorting function which
> cannot be memoized.  (Issues of syntax aside; just caching the result of
> comparing any two pairs of data results in caching data that a sane
> sorting algorithm will never use again.  

Well, we seem to be talking about different things.

I'm talking about memoizing the key extraction function.

Even a *sane* sorter will call get_keys($a) multiple times
for any given value of $a, in general.

But I guess your question still stands:  Why/when would we
ever *not* want to cache the result?  Any user code which
depends on how many times the key extraction function was
called is certainly kludgerific, and should not be condoned! :-)

-- 
John Porter

Give the braindead no head.

Reply via email to