[Haskell-cafe] Re: Zippers

Cristiano Paris frodo at theshire.org
Thu Mar 5 04:05:01 EST 2009


On 3/5/09, Ryan Ingram <ryani.spam at gmail.com> wrote:
> ...
> Here is the problem with your "update":
>
> tree = Fork (Leaf 1) (Leaf 2)
> ztree = initZ tree
>
> test = fromJust $ do
>    z1 <- moveLeft ztree
>    let z2 = update z1 3
>    z3 <- moveUp z2
>    z4 <- moveLeft z3
>    this z4
>
> I'd expect "test" to equal 3, but I believe with your code that it
> still equals 1.  As apfelmus said, update needs to completely
> re-construct the zipper structure with the tied knot, which defeats
> the purpose of using a zipper in the first place.

I got it. I dont't know what your expression "tied knot" is referring
to but I got the point.

Thanks.

Cristiano


More information about the Haskell-Cafe mailing list