[Haskell-beginners] Re: [Haskell-begin] Looking for cunning ways to update a tree

Quergle Quergle quergle at googlemail.com
Tue Jul 29 17:19:43 EDT 2008

Hi Chris,

Thanks for the further pointers!

On Mon, Jul 28, 2008 at 11:12 AM, Chris Eidhof <chris at eidhof.nl> wrote:
> Yes, indeed. However, folds are a nice way to factor out recursion and can
> make life a whole lot easier...In a way, folding is a really essential traversal of a
> data structure, so it can be seen as a primitive.

I'll admit to having seen folds before and being soundly impressed by
how they capture a general pattern of recursion.  Indeed, what
actually prompted me to start this thread was that I had a function
(updateTree) which did explicit recursion across a list, but I
couldn't see a way to express it as (say) a fold. I guess I was
wondering if there was any way to factor out the "updateTree" pattern
of recursion in terms of simpler primitives (even though, for example,
using a tree fold might be the more sensible choice for the particular

-- Matt

More information about the Beginners mailing list