We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Complete Haskell solution with different main function that is far more workable.
main = interact $ unlines . map solve . map (read :: String -> Double) . tail . words
e :: Double -> [Double]
e x = [x**y / (product [1..y]) | y <- [0..]]
solve :: Double -> String
solve x = show `$ sum $` take 10 (e x)
Evaluating e^x
You are viewing a single comment's thread. Return to all comments →
Complete Haskell solution with different main function that is far more workable.