
On Thu, Aug 17, 2006 at 01:23:19AM -0400, ajb@spamcop.net wrote:
G'day all.
Quoting Chris Kuklewicz
: 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... Best, Tamas