def once.go
import ezx@1.11.0.0/src/ledger/ignore.bend as Ignoreimport Base
import ezx@1.11.0.0/src/ledger/manifest.bend as M
217# each hash once, where it first appears, passing over any `seen` already
218# holds. An empty hash names no tree; `M.parse` refuses a dependency with
219# none, so that only guards a model built by hand.
220def once.go(hs: List<&2, String>, +seen: List<&2, String>) -> List<&2, String>:
221 match hs:
222 case []:
223 []
224 case +h <> t:
225 +skip = Bool.or(String.is_empty(h), named(seen, h))
226 once.put(skip, h, once.go(t, once.seen(skip, h, seen)))