Automatic memoizing in functional programming languages

前端 未结 6 523
故里飘歌
故里飘歌 2020-12-08 14:59

I always thought that Haskell would do some sort of automatic intelligent memoizing. E.g., the naive Fibonacci implementation

fib 0 = 0
fib 1 = 1
fib n = fib         


        
6条回答
  •  执念已碎
    2020-12-08 15:15

    No exactly an answer, but this page: http://www.haskell.org/haskellwiki/Memoization offers ideas about Memoization in Haskell and also shows a list-based implementation of the Fibonacci sequence that may be of interest.

提交回复
热议问题