On Thu, Apr 24, 2008 at 12:44 AM, Graham Fawcett <[EMAIL PROTECTED]> wrote: > I'm studying zippers (and by extension, the State monad), and have > written a function for finding the first node-location in a 'zippered' > tree that satisfies a predicate: > > http://paste.lisp.org/display/59636 > > (The code uses Krasimir Angelov's Data.Tree.Zipper.) My code works, > but I suspect that I'm working too hard. I would appreciate any > comments!
I did figure out an easier way: lazily walk every location in the tree, and take the first matching location. http://paste.lisp.org/display/59636#1 Much cleaner (though comments are still welcome.) Haskell seems to have a high 'commute factor' -- many solutions appear not at the keyboard, but while driving home... Graham _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe