[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Memoization as alternative to mutation
- To: address@hidden
- Subject: Memoization as alternative to mutation
- From: "Michael St. Hippolyte" <address@hidden>
- Date: Thu, 12 Feb 2004 11:16:01 -0500
- Sender: address@hidden
- User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007
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