On Wednesday, March 8, 2017 at 11:52:39 AM UTC, Rupert Smith wrote:
>
> Anyone written a fold operation over Zipper navigation operations using 
> tomjkidd/elm-multiway-tree-zipper?
>

I think this will do it:

foldl : (Zipper a -> Maybe (Zipper a)) -> (Zipper a -> b -> b) -> b -> 
Zipper a -> b
foldl navop func accum zipper =
    case navop zipper of
        Nothing ->
            func zipper accum

        Just nextZipper ->
            foldl navop func (func zipper accum) nextZipper

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to