Alex Rozenshteyn schrieb:
> I feel that there is something that I don't understand completely: I
> have been told that Haskell does not memoize function call, e.g.
>> slowFib 50
> will run just as slowly each time it is called. However, I have read
> that Haskell has call-by-need semantics, which
Alex,
Maybe this pdf can enlighten you a little bit about memoization and lazy
evaluation in Haskell =>
http://www.cs.uu.nl/wiki/pub/USCS2010/CourseMaterials/A5-memo-slides-english.pdf
Cheers.
Roman.-
I feel that there is something that I don't understand completely: I have
> been told that H
Alex Rozenshteyn writes:
> I understand that
>> fib50 = slowFib 50
> will take a while to run the first time but be instant each subsequent call;
> does this count as memoization?
I didn't see anybody else answering this in so many words, but I'd say
no, since you only name one particular valu
On 9/15/10 10:39 PM, Conal Elliott wrote:
Hi Alex,
In Haskell, data structures cache, while functions do not.
Exactly. What this means is that when you call (slowFib 50) Haskell does
not alter slowFib in any way to track that it maps 50 to $whatever;
however, it does track that that particul
Hi Alex,
In Haskell, data structures cache, while functions do not.
"Memoization" is conversion of functions into data structures (and then
trivially re-wrapping as functions) so as to exploit the caching property of
data structures to get caching functions.
- Conal
On Wed, Sep 15, 2010 at 11
On Wednesday 15 September 2010 22:38:48, Tim Chevalier wrote:
> On the other hand, if you wrote:
>
> let fib50 = slowFib 50 in
> fib50 + (slowFib 50)
>
> then (slowFib 50) would be evaluated twice, because there's no
> principle requiring the compiler to notice that (slowFib 50) is the
> same exp
On 9/15/10, Alex Rozenshteyn wrote:
> I feel that there is something that I don't understand completely: I have
> been told that Haskell does not memoize function call, e.g.
> > slowFib 50
> will run just as slowly each time it is called. However, I have read that
> Haskell has call-by-need sema
I feel that there is something that I don't understand completely: I have
been told that Haskell does not memoize function call, e.g.
> slowFib 50
will run just as slowly each time it is called. However, I have read that
Haskell has call-by-need semantics, which were described as "lazy evaluation