[Haskell-cafe] Perfect example

Dan Piponi dpiponi at gmail.com
Fri Aug 3 10:46:03 EDT 2007


On 8/2/07, Jon Harrop <jon at ffconsultancy.com> wrote:
> Any suggestions for a perfect example that uniquely demonstrates the benefits
> of the Haskell language compared to other languages?

For short and sweet, power series is a nice example. Try
http://www.polyomino.f2s.com/david/haskell/hs/PowerSeries.hs.txt or
http://www.cs.dartmouth.edu/~doug/powser.html. Makes nice use of
laziness to allow power series to consume earlier members of the
series to produce later ones. Power series 'reversion' has
traditionally been a tricky thing to code up but it's almost trivial
in Haskell. And power series for many transcendental functions can be
implemented directly from defining differential equations.
--
Dan


More information about the Haskell-Cafe mailing list