Sigh. First streams, now matrices. The Ubuntu repositories don't have all the Haskell packages one would like. I guess it's going to come to removing the Ubuntu packages and building ghc and associated code myself or via.... [cue ominous music]... cabal.
I may combine that with a switch to Sabayon Linux, which will let me get back into Gentoo with minimal hassle, and also return to Enlightenment.
Once I can get the packages I want, it should be pretty easy to do Project Euler #11; the main trick for me is reading the input, and I think something like this should do the trick:
import qualified Data.Matrix as M
import qualified Data.ByteString.Char8 as B
parseLine :: B.ByteString -> [Int]
parseLine s = case B.parseInt s of
Nothing -> 
Just (n, s') -> n : parseLine s'
main = do
s <- getContents
let m = M.fromLists $ map (parseLine . B.pack) (lines s)
and then it's just how to generate the contiguous portions of the matrix so I can find which one has the maximum product.
You've probably heard about how the notion of sum types (e.g. Algol 68 union s, Rust enum s, Haskell type s) and product types (e.g. tup...
As I've mentioned recently, I'm now in a Meetup for people in the Des Moines, IA area where we're seriously doing the problems a...
If I don't already have the Haskell subreddit link over on the right, I'll add it ASAP. This evening a Haskell beginner posted a...
While going through old papers, I found something I wrote as a follow-up to an article by Aaron Banerjee in the February 1999 issue of t he...