On Tue, Sep 25, 2007 at 10:31:34AM +0100, Dougal Stanton wrote: > On 25/09/2007, Andrew Coppin <[EMAIL PROTECTED]> wrote: > In this instance I would suggest: > > (1) Text.Printf > (2) Pull out some of those things into separate functions with > where/let clauses. > > If it's a matrix you should probably have something like > > > showMatrix = concatMap showRow > > Since you'll be applying the same procedures to each line of digits.
Just to follow those sentiments, the version I knocked out quickly looked like: (It's not quite the same as the original function, I think I'm lacking a map (map (take 8)) on the first line). showSystems :: Show a => [[a]] -> String showSystems = unlines . zipWith showSystem [1..] where showSystem n as = "Eq" ++ (show n) ++ ": " ++ sum ++ " = " ++ val where sum = concat . intersperse " + " . zipWith showNum [1..] $ (init as) val = show . last $ as showNum n a = show a ++ " x" ++ show n Pointsfree and explicit lambda notation I find can be very concise in places, but make it quite hard to reuse or refactor code later - if you can't read it, make a function/variable with a useful name so you can later. Regards, T -- Tristan Allwood PhD Student Department of Computing Imperial College London _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe