Source

xp.memo / code / Main.hs

Diff from to

code/Main.hs

 module Main where
   
-import Memo.SNMap.SNMap
+import qualified Memo.SNMap.SNMap as S ( memo )
 
-main = print "Hello :)"
+import qualified Memo.Tries.Conal as C ( memo , untrie , trie ) 
+
+import Debug.Trace ( trace )
+
+main = print "Hello :) "
+
+memoTrace = C.untrie . (trace "Building trie" C.trie)
+
+sfib :: Integer -> Integer
+sfib = C.untrie fibtrie
+
+sfib' :: Integer -> Integer
+sfib' 0 = 0
+sfib' 1 = 1
+sfib' n = sfib (n-2) + sfib (n-1)
+
+
+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