You are viewing a single comment's thread. Return to all comments →
how do I implement memoization in Haskell?
import Data.List fibos = take 10001 fibo 0 1 where fibo a b = a:(fibo b (a+b)) main = getLine >> getContents >>= putStrLn . unlines . map (show . fib . read) . lines where fib n = (flip mod (10^8+7)) . fibos !! n
Seems like cookies are disabled on this browser, please enable them to open this website
Fibonacci
You are viewing a single comment's thread. Return to all comments →
how do I implement memoization in Haskell?