17 Aug
2006
17 Aug
'06
1:23 p.m.
G'day all. Quoting Chris Kuklewicz <haskell@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. Cheers, Andrew Bromage