Hi

> complex. The input is quite simple (it's a bunch of numbers), the output
> is quite simple (it's a neatly formatted string), but the process in the
> middle is... a mess. I'd like to find a more readable way of doing stuff
> like this. It's not just this specific function; any general hints would
> be good. ;-)

A nice auxiliary would help:

showEqn :: Int -> [Double] -> String
showEqn i vs = ...
    where
          (add,ans) = (init vs, last vs)

Then you can half the complexity. There are probably a few useful
functions that aren't in the standard libraries (consperse, joinWith
etc) that you could make use of.

You seem to be doing take 8 on the double - what if the double prints
out more information than this as the result of show?
1000000000000000000 could end up a bit smaller.

Thanks

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

Reply via email to