Anonymous user
Polynomial derivative: Difference between revisions
m
→{{header|Haskell}}: fixed pretty printing
(→{{header|Haskell}}: added solution) |
m (→{{header|Haskell}}: fixed pretty printing) |
||
Line 205:
showPoly [] = "0"
showPoly p = foldl1
dropWhile null $
zip p [0..]
where
(i,1) -> "x^" ++ show i▼
term = \case [] -> ""
▲ (i,c) -> show c ++ "*x^" ++ show i
'-':t -> " - " ++ t
main = mapM_ (putStrLn . line) ps
|