def is_same.go

bend-lint-rules@0.2.0.0 · layout/format.bend:303

import bend-lint-rules@0.2.0.0/layout/format.bend as Format
import 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{}

Uses (3)

Used by (1)