Skip to content

Instantly share code, notes, and snippets.

@viercc
Last active December 16, 2015 14:49
Show Gist options
  • Save viercc/5451090 to your computer and use it in GitHub Desktop.
Save viercc/5451090 to your computer and use it in GitHub Desktop.
-- simple test for NatSet.hs
--
-- I did the performance test by running
-- $ time ./natset_perf
-- command, where natset_perf is compiled executable of this code.
import NatSet
import System.Random
import Control.Monad (forM_)
randomBytes :: [Int]
randomBytes = randomRs (0, 255) (mkStdGen 20130234)
takeEach n [] = []
takeEach n list = firstNElem : takeEach n tailList
where (firstNElem, tailList) = splitAt n list
testData = take 10 $ takeEach 10 $ randomBytes
main = forM_ testData $ \input ->
do putStrLn "Test Input:"
print input
putStrLn "Result:"
printClosure input
putStrLn ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment