def order.put

bend-kit-unicode@0.1.0.0 · unicode.bend:43

import bend-kit-unicode@0.1.0.0/unicode.bend as Unicode
import Base

43# Canonical ordering: c, of class k > 0, goes past each mark of a higher class. go says whether acc's head is one.
44def order.put(acc: String, go: Bool, +c: U32, +k: U32) -> String:
45  match acc:
46    case SNil{}:
47      SCon{Chr{c}, SNil{}}
48    case SCon{Chr{+h}, +t}:
49      match go:
50        case True{}:
51          SCon{Chr{h}, order.put(t, order.gt(t, k), c, k)}
52        case False{}:
53          SCon{Chr{c}, SCon{Chr{h}, t}}

Uses (5)

Used by (1)