Hello Jefferson, Wednesday, June 20, 2007, 12:20:28 AM, you wrote:
> 4-byte int (count), > (count) 2-byte unsigned shorts, > (count) 4-byte floats using my Streams package ( http://haskell.org/haskellwiki/Library/AltBinary ): import Data.AltBinary readall recordcount h = do replicateM recordcount $ do count <- getWord32le h keys <- replicateM count (getWord16le h :: IO Int) values <- replicateM count (getFloat h) return (IntMap.fromList (zip keys values)) This isn't lazy and not tested > all in little-endian order. What I want to do is read each record > (lazily), and unpack it into Data.IntMap.IntMap Float where the unsigned > shorts become the keys and the 4-byte floats become the values. > Then I want to do a lot of interesting processing which we'll skip here, > and write back out packed data to a file in the format of > 4-byte float, > 4-byte float, > 4-byte float > for each record. use either putFloat or define structure of 3 floats: data F = F Float Float Float and put entire F to the stream: mapM_ put_ (IntMap.values your_map) -- Best regards, Bulat mailto:[EMAIL PROTECTED] _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe