def dir_of.go

bolt@1.26.0.0 · src/config.bend:170

import bolt@1.26.0.0/src/config.bend as Config
import Base
import bolt@1.26.0.0/src/rchars.bend as Rchars

170# a path's directory, with its slash; `` at the top
171def dir_of.go(cs: List<&2, Char>, +acc: List<&2, Char>, best: List<&2, Char>) -> String:
172  match cs:
173    case Nil{}:
174      Rchars.text(best)
175    case Con{'/', t}:
176      dir_of.go(t, '/' <> acc, '/' <> acc)
177    case Con{c, t}:
178      dir_of.go(t, c <> acc, best)

Uses (8)

Used by (1)