
On 28 Jan 2008, at 11:00 PM, Henning Thielemann wrote:
On Mon, 28 Jan 2008, Jonathan Cast wrote:
Or, to put it another way, the bugs Java's stack overflow is designed to catch are considered good style in Haskell.
I consider explicit recursion in Haskell as bad style. One should use higher order functions like 'map', 'fold', 'filter' and so on whereever possible. Even if one needs explicit recursion one should separate the traversal through a data structure from the particular operation applied to the elements.
Maybe so, but this approach is impossible in Java (and not just because of the limitation on the size of the stack). Imperative programs tend to rely on a small number of loop constructs repeated over and over again; good style in Haskell is in part recognizing when new constructs are preferable and implementing them (recursively). It's a completely different mindset. jcc