Thanks for your help, guys! I like simple solutions most of all :)
On Fri, Jul 11, 2008 at 9:44 PM, Reid Barton <rwbarton@math.harvard.edu> wrote:
This doesn't require any fancy data structures.
Instead store this as a list of pairs [([10,6,80,25,6,7], 5), ...]
and it'll be easy to write a recursive function that accepts a new
vector and either increments the appropriate count or adds the new
vector at the end with count 1.
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.