def String.order.go

Base · base.bend:2053

import Base
2053# c is the order of the chars so far: the walk is one tail call per char
2054# and builds nothing (String.cmp rebuilds both strings for its callers).
2055def String.order.go(a: String, b: String, c: Cmp) -> Cmp:
2056  match a b c:
2057    case SNil{} SCon{h, t} EQ{}:
2058      LT{}
2059    case SCon{h, t} SNil{} EQ{}:
2060      GT{}
2061    case SCon{Chr{x}, t1} SCon{Chr{y}, t2} EQ{}:
2062      String.order.go(t1, t2, U32.cmp(x, y))
2063    case _ _ o:
2064      o

Uses (4)

Used by (4)