def string

bend-kit-collections@0.1.4.1 · order.bend:13

import bend-kit-collections@0.1.4.1/order.bend as Order
import Base

13# Strings in code-point order, a prefix before its extensions. String.order gives
14# the same answers, but it rebuilds both strings on every call.
15def string(a: String, b: String) -> Cmp:
16  match a b:
17    case SNil{} SNil{}:
18      EQ{}
19    case SNil{} SCon{h, t}:
20      LT{}
21    case SCon{h, t} SNil{}:
22      GT{}
23    case SCon{Chr{+x}, s} SCon{Chr{+y}, t}:
24      string.fin(U32.cmp(x, y), string(s, t))

Uses (5)

Used by (10)