ex128 is
node(name String, children Sequence node) is
breadth_first_traverse(f node -> unit, root node) =>
breadth_first_traverse(queue Sequence node) unit =>
match queue.as_list
nil =>
c Cons =>
f c.head
breadth_first_traverse (c.tail ++ c.head.children)
breadth_first_traverse [root]
five := node "Belarus" (list node).empty
six := node "Portugal" (list node).empty
two := node "Europe" [five, six]
three := node "Asia" (list node).empty
four := node "Oceania" (list node).empty
one := node "World" [two, three, four]
breadth_first_traverse (node -> say node.name) one