def string.equal.go

gralha-text-scan@0.1.0.1 · scan.bend:40

import gralha-text-scan@0.1.0.1/scan.bend as Scan
import Base

40# `same` says whether the characters before `a` and `b` matched: deciding
41# it one step ahead keeps the loop a tail call on the shrinking `a`.
42def string.equal.go(a: String, b: String, same: Bool) -> Bool:
43  match a b same:
44    case SNil{} SNil{} True{}: True{}
45    case SCon{Chr{x}, xs} SCon{Chr{y}, ys} True{}: string.equal.go(xs, ys, U32.is_eq(x, y))
46    case _ _ _: False{}

Uses (4)

Used by (1)