Source

xp.memo / code / Main.hs

Full commit
module Main where
  
import qualified Memo.SNMap.SNMap as S ( memo )

import qualified Memo.Tries.Conal as C ( memo , untrie , trie ) 

import Debug.Trace ( trace )

import System.Vacuum.Ubigraph ( view )

main = do putStrLn "--"
          print (mfib' 30000)
          putStrLn "--"
          print (mfib' 30003)
          
memoTrace = C.untrie . (trace "Building trie" C.trie)

mfib :: Integer -> Integer
mfib = memoTrace mfib'

mfib' :: Integer -> Integer
mfib' 0 = 0
mfib' 1 = 1
mfib' n = mfib (n-2) + mfib (n-1)

memostring :: String -> String
memostring = C.memo reverse