def fold.edges
import bend-visgraph@2.0.0.0/visgraph.bend as Visgraphimport Base
855# `f(acc, src, dst, w)` over every edge of `g`, in the order the rope
856# holds them, from `acc`.
857def fold.edges(~A: Type, ~f: A -> U32 -> U32 -> F32 -> A, es: Edges, acc: A) -> A:
858 match es:
859 case ENil{}:
860 acc
861 case ECon{s, t, w, next}:
862 fold.edges(~A, ~f, next, f(acc, s, t, w))
863 case EJoin{a, b}:
864 fold.edges(~A, ~f, b, fold.edges(~A, ~f, a, acc))