def trim.back
import ezx@1.11.0.0/src/pkg/pkg.bend as Pkgimport Base
100# a line with its trailing blanks dropped, read from the front, so that the
101# trim of a line is a walk over it rather than over its reverse
102def trim.back(line: String) -> String:
103 match line:
104 case SNil{}:
105 SNil{}
106 case SCon{+h, t}:
107 +rest = trim.back(t)
108 trim.back.at(Bool.and(blank(h), String.is_empty(rest)), h, rest)