def paint.order.normalize
gralha-svg-render@0.1.0.1 · svg.bend:1919
import gralha-svg-render@0.1.0.1/svg.bend as Svg
import Base
import gralha-text-scan@0.1.0.1/scan.bend as U
1919
1920
1921def paint.order.normalize(s: String, +out: String, +gap: Bool) -> String:
1922 match s:
1923 case SNil{}: out
1924 case SCon{Chr{c}, rest}:
1925 +ch = c
1926 +tail = rest
1927 U.branch(String, U.space(ch), _ => paint.order.normalize(tail, out, Bool.not(U.string.equal(out, ""))),
1928 _ => paint.order.normalize(tail, out ++ U.choose(String, gap, " ", "") ++ SCon{Chr{ch}, SNil{}}, False{}))