def chain
import bolt@1.26.0.0/src/config.bend as Configimport Base
239# the bolt.bend of a resolved directory (innermost first, as `home` gives it)
240# and of each parent up to the root, nearest first: `[p3, w]` is
241# `/w/p3/bolt.bend`, `/w/bolt.bend`, `/bolt.bend`
242def chain(ds: List<&2, String>) -> List<&2, String>:
243 match ds:
244 case Nil{}:
245 ["/bolt.bend"]
246 case Con{d, +rest}:
247 (root(d <> rest, "") ++ "bolt.bend") <> chain(rest)