On 7/20/05, yin <[EMAIL PROTECTED]> wrote: > Hi, > > I need to parse a file in this format: > float float float > float float float > Each row has 3-columns of floating procision number divided by white > space. The number of lines is undefined. I use (lines (readFile "...")) > to read the file. >
Off the top of my head: readVecs :: String -> IO [Vector3 GLfloat] readVecs f = do str <- readFile f let mkVec [x,y,z] = Vector3 x y z return $ map (mkVec . read . words) $ lines str Of course this won't exactly fail gracefully if the file is corrupt or anything like that... /S -- Sebastian Sylvan +46(0)736-818655 UIN: 44640862 _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe