Created
June 8, 2011 17:07
-
-
Save tsuraan/1014840 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Prelude> let c = Data.ByteString.Lazy.cycle | |
Loading package bytestring-0.9.1.7 ... linking ... done. | |
Prelude> let p = Data.ByteString.Lazy.Char8.pack | |
Prelude> let bfoldr = Data.ByteString.Lazy.foldr | |
Prelude> let bs = c $ p "hello there" | |
Prelude> let hasher w ~(pos, hash, lst) = let nhash = hash+(fromIntegral w) in if nhash > 2 then (pos+1, nhash, pos:lst) else (pos+1, nhash, lst) | |
Prelude> let (_,_,ans) = bfoldr hasher (0, 2, []) bs | |
Prelude> head ans | |
^CInterrupted. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment