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. On Fri, Jul 11, 2008 at 11:32 PM, Dan Weston <westondan@imageworks.com> wrote:
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.
-- Dmitri O. Kondratiev dokondr@gmail.com http://www.geocities.com/dkondr