on master help sign in
Fix bugs in fasta implementation
commitde098f2f3e2a8a0ac9dfc325eea5747518415ef4 authorPaul Koerbitz <paul.koerbitz@theppro.com> dateSat 19 Apr 2014, 19:52 (13 years ago) parentd90731e
1 file changed+5−4
benchmarks/fasta/fasta.idr+5−4
benchmarks/fasta/fasta.idr+5−4
@@ -62,16 +62,17 @@ make name n0 tbl seed0 = do
6262 fill _ _ = []
6363
6464 lookupTable : String
65− lookupTable = Foldable.concat (fill (drop 1 $ scanl accum ('a',0) tbl) 0)
65+ lookupTable = Foldable.concat (fill (scanl accum ('a',0) tbl) 0)
6666
6767 make' : Int -> Int -> Int -> String -> IO Int
6868 make' 0 col seed buf = when (col > 0) (putStrLn buf) $> return seed
6969 make' n col seed buf = do
70− let newseed = modInt (seed * 3877 + 39573) modulus
70+ let newseed = modInt (seed * 3877 + 29573) modulus
7171 let nextchar = strIndex lookupTable newseed
72+ let newbuf = buf <+> singleton nextchar
7273 if col+1 >= 60
73− then putStrLn buf $> make' (n-1) 0 newseed (singleton nextchar)
74− else make' (n-1) (col+1) newseed (strCons nextchar buf)
74+ then putStrLn newbuf $> make' (n-1) 0 newseed ""
75+ else make' (n-1) (col+1) newseed newbuf
7576
7677
7778main : IO ()