def same
import bolt@1.27.0.0/src/syntax/bind.bend as Bindimport Base
import bolt@1.27.0.0/src/lazy/lazy.bend as Lazy
226# two names alike, char by char, stopping at the first that differs:
227# String.eq, without the pairs String.cmp builds on every step
228def same(aa: String, bb: String) -> Bool:
229 match aa bb:
230 case SNil{} SNil{}:
231 True{}
232 case SNil{} SCon{_h2, _t2}:
233 False{}
234 case SCon{_h1, _t1} SNil{}:
235 False{}
236 case SCon{h1, t1} SCon{h2, t2}:
237 Lazy.and_then(Char.is_eq(h1, h2), _u => same(t1, t2))