def is_same.go
import bend-lint-rules@0.2.0.0/layout/format.bend as Formatimport Base
303# Base's String.eq is not tail-recursive, so long text would overflow the stack; is_same is.
304# ok: whether the characters so far were the same.
305def is_same.go(a: String, b: String, ok: Bool) -> Bool:
306 match a b ok:
307 case SCon{x, xs} SCon{y, ys} True{}:
308 is_same.go(xs, ys, Char.is_eq(x, y))
309 case SNil{} SNil{} done:
310 done
311 case _ _ _:
312 False{}