def to_list.go
import bend-lawful-stdlib@0.1.0.0/src/tree.bend as Treeimport Base
29# the leaves, left to right, in front of acc
30def to_list.go(-A: Data, t: Tree<A>, acc: List<&2, A>) -> List<&2, A>:
31 match t:
32 case Tip{x}:
33 x <> acc
34 case Fork{l, r}:
35 to_list.go(A, l, to_list.go(A, r, acc))