algorithm - How to output an Integer array in Haskell using ByteString? -


my sample code define , fill output (integer) ioarray:

{-# options_ghc -o2 #-} {-# language bangpatterns #-}  import data.array import data.array.io  for_ xs f =  mapm_ f xs  a_size = 10000 :: int  main :: io() main =        <- newarray (0,a_size-1) 1 :: io (ioarray int integer)       for_ [3,4..(a_size-1)] $ \i -> -- generate array          t1 <- readarray (i-3)          t2 <- readarray (i-2)          t3 <- readarray (i-1)          writearray (4*t1+t2+2*t3)       for_ [0,1..(a_size-1)] $ \i -> -- print terms of array          temp <- readarray          print(temp)       return() 

obviously real code longer compute (another) 'a' integer array. speedup output section using bytestring, don't know how it.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -