staafmeister wrote:
Yes I know but there are a lot of problems requiring O(1) array updates
so then you are stuck with IO again

Or use ST. Or use IntMap (which is O(log n), but n is going to max out on the integer size for your architecture, so it's really just O(32) or O(64), which is really just constant time).

And, realistically, very few problems actually require indexed access on a large scale like this.

[parsing stuff]

As far as parsing is concerned, maybe you should look at Parsec. I know it sounds like overkill, but it's easy enough to use that it's quite lightweight in practice. Your example scenario:

    inputData :: Parser InputData
    inputData = many1 digit *> newline *> many (testCase <* newline)
        where testCase = many1 digit *> newline *> sepBy edge (char ' ')
              edge = liftA2 (,) (many nonspace <* char ' ')
                                (read <$> digits)

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

Reply via email to