[Haskell-cafe] iterative algorithms: how to do it in Haskell?

Tamas K Papp tpapp at Princeton.EDU
Thu Aug 17 03:10:43 EDT 2006

On Thu, Aug 17, 2006 at 01:23:19AM -0400, ajb at spamcop.net wrote:
> G'day all.
> Quoting Chris Kuklewicz <haskell at list.mightyreason.com>:
> > The compiler may not deforest that list, so creating the list may be a small
> > overhead of this method.
> And in return, you get:
>     - Code that is smaller than the imperative version, AND
>     - a reusable function, making the next incarnation of
>       an algorithm like this even shorter.
> For most interesting cases, the cost of f and goOn will surely dominate
> anyway.
> > Note that "f x" should be "f a" above.
> Yes, you're right.  I abstracted out "f" after testing and before
> posting.

Chris, Christian, Andrew, Antti-Juhani and Ivan,

Thanks for your answers, they were very enlightening (though it will
take some time to understand everything).  Haskell looks even more
elegant than Scheme...



More information about the Haskell-Cafe mailing list