def home.segs

bolt@1.26.0.0 · src/config.bend:213

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

213# the directories a path names, innermost first: its segments, split at `/`,
214# each read by `home.step` onto those before it (seg holds the segment being
215# read, reversed)
216def home.segs(cs: List<&2, Char>, seg: List<&2, Char>, above: List<&2, String>) -> List<&2, String>:
217  match cs:
218    case Nil{}:
219      home.step(Rchars.text(seg), above)
220    case Con{'/', t}:
221      home.segs(t, [], home.step(Rchars.text(seg), above))
222    case Con{c, t}:
223      home.segs(t, c <> seg, above)

Uses (9)

Used by (1)