On 12 Jan 2008, at 3:16 PM, Hugh Perkins wrote:

On Jan 12, 2008 10:54 PM, Henning Thielemann
<[EMAIL PROTECTED]> 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,

Right.

and that the interpreter
can,

Right.

and will,

Caching is not infrequently a terrible implementation strategy, for space reasons (and sometimes for time reasons as well). Deciding whether to use it is a delicate engineering tradeoff, and, while the compiler will do its best, the starting point is decided by the programmer. Lists get cached by default; functions over integers do not. The compiler may change that decision, but it will make sure to nail down in triplicate that doing so is an improvement for every program subject to the optimization first, which means it probably won't.

cache this answer?

jcc

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to