[Haskell-cafe] [newbie question] Memoization automatic in Haskell?

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Sat Jan 12 18:19:22 EST 2008

On Jan 12, 2008, at 18:16 , Hugh Perkins wrote:

> On Jan 12, 2008 10:54 PM, Henning Thielemann
> <lemming at henning-thielemann.de> wrote:
>> On Sat, 12 Jan 2008, Hugh Perkins wrote:
>>> I guess that Haskell's referential transparence means the answers to
>>> the isPerfectSquare will be cached, ie automatically memoized? (not
>>> sure if is correct term?)
>> http://www.haskell.org/haskellwiki/Memoization
> Interesting... but I dont understand... I thought that referential
> transparence meant that once the answer to a function has been
> calculated once, it will always be the same, and that the interpreter
> can, and will, cache this answer?

It *can* cache the answer, if it so chooses... but that often turns  
out to be a pessimization, as it caches values that are only used  
once or twice.

brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH

More information about the Haskell-Cafe mailing list