Dmitri O.Kondratiev wrote:
I need extendable array to store and count unique vectors. I have a file containing vectors presented as strings like:
10, 6, 80, 25, 6, 7
1, 2, 15, 17, 33, 22
21, 34, 56, 78, 91, 2
...
(BTW, what is the best library function to use to convert string of digits into a list or array?)

If you don't need to do error checking on the input syntax, the easiest (and arguably fastest) method is just read:

Prelude> let x = "10, 6, 80, 25, 6, 7"
Prelude> read ("[" ++ x ++ "]") :: [Int]
[10,6,80,25,6,7]

For error checking, you can use reads.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to