def walk

bolt@1.27.0.0 · src/lint/plan.bend:101

import bolt@1.27.0.0/src/lint/plan.bend as Plan
import Base
import bolt@1.27.0.0/src/lint/world.bend as W

101# every `.bend` file under the directories still queued, the fuel bounding how
102# many directories are read, each read through the World's listing. What is
103# found is put in front of what came before, not after it, so the walk stays
104# linear; `files` sorts at the end regardless.
105def walk(
106  fuel: Nat,
107  +world: W.World,
108  queue: List<&2, String>,
109  acc: List<&2, String>,
110  seen: List<&2, String>
111) -> Walk:
112  match fuel:
113    case 0n:
114      Walk{acc, seen}
115    case 1n+f:
116      match queue:
117        case Nil{}:
118          Walk{acc, seen}
119        case Con{+dir, rest}:
120          +es = W.listing(world, dir)
121          walk(f, world, List.append(&2, String, rest, walk.dirs(es, dir)),
122            List.append(&2, String, walk.bends(es, dir), acc), dir <> seen)

Uses (9)

Used by (1)