def norm.put

bolt@1.27.0.0 · src/rules/imports.bend:14

import bolt@1.27.0.0/src/rules/imports.bend as Imports
import Base

14# a segment onto the reversed path: `.` and empty are dropped, `..` pops
15def norm.put(+ss: String, acc: List<&2, String>) -> List<&2, String>:
16  match acc:
17    case Con{+h, +t}:
18      Bool.pick(List<&2, String>, String.eq(ss, ".."), t,
19        Bool.pick(List<&2, String>, Bool.or(String.eq(ss, "."), String.is_empty(ss)), h <> t, ss <> (h <> t)))
20    case Nil{}:
21      Bool.pick(List<&2, String>, Bool.or(String.eq(ss, ".."), Bool.or(String.eq(ss, "."), String.is_empty(ss))),
22        [], [ss])

Uses (6)

Used by (1)