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

Memoization as alternative to mutation

Hi all,

I'm curious as to what is the language community's general feeling towards 
memoization and caching as a substitute for mutation.  I'm less concerned with 
labels (i.e. whether or not memoization counts as "pure" FP) than with 
usefulness.  Has memoization proven to be a useful way to implement things like 
sorting algorithms, parsers, design patterns, etc?

I ask because after playing around with a very simple memoization approach for 
the last few weeks I've been amazed and intrigued at what can be done with it. 
  With memoization, you no longer think of state as information in a memory 
slot somewhere.  Rather, state becomes a dynamic property of lexical scopes. 
It's the ideal complement to lazy evaluation -- lazy unevaluation you might 
call it.  To me it seems both more general and more powerful than mutation.  Is 
this a shared view?  Or is memoization regarded more as just mutation in disguise?

Thanks in advance.

Michael St. Hippolyte