def places
cli@0.2.0.0 · cli.bend:6231
import cli@0.2.0.0/cli.bend as Cli
import Base
6231
6232def places(items: List<&2, Item>, +words: List<&2, String>,
6233 +globals: List<&2, Item>) -> List<&2, Place>:
6234 match items:
6235 case Nil{}: Nil{}
6236 case Sub{name, about, +children} <> tail:
6237 +here = List.append(&2, String, words, [name])
6238 List.append(&2, Place,
6239 Bool.pick(List<&2, Place>, has_hidden(children), [],
6240 Place{here, children, globals} <> places(children, here,
6241 List.append(&2, Item, globals, global_items(children)))),
6242 places(tail, words, globals))
6243 case head <> tail: places(tail, words, globals)