Thanks Paul & Paul for the answers. I'll certainly read the paper Paul Liu 
reported.

I just deleted 100 lines of text which explained my problem in more detail, and 
while I was explaining it, I answered it myself. Typical. I thought the lambda 
function that memo1 returns would be called over and over again, and instead of 
reevaluating the stream from the beginning, it would just return the stream 
since it is in the cache, but actually it just gets called twice in recursive 
situations: the first time it evaluates y = f x, stores the thunk in the cache, 
and returns the thunk, the second time it finds the same thunk in the cache, 
and then computation of the rest of the stream continues without consulting the 
cache anymore right? From my clumsy explanation you can see that I'm still 
thinking too imperative, too eager. Haskell is more lazy than I am, which is an 
incredible achievement :-)

It would really help if I could see the lazy computation; do you think this 
kind of memo code is traceable using HAT?

I'll guess I'll have to check out arrows / yampa again. A year ago I did not 
understand a single thing in those papers, but I should try it again now I read 
the SOE book :-)

Thanks a lot,
Peter



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

Reply via email to