def last_segment

bolt@1.27.0.0 · src/lsp/semantic.bend:32

import bolt@1.27.0.0/src/lsp/semantic.bend as Semantic
import Base

32# the last segment of a dotted name
33def last_segment(cs: List<&2, Char>, +acc: List<&2, Char>) -> List<&2, Char>:
34  match cs:
35    case Nil{}:
36      List.reverse(&2, Char, acc)
37    case Con{'.', t}:
38      last_segment(t, [])
39    case Con{c, t}:
40      last_segment(t, c <> acc)

Uses (7)

Used by (1)