Openapi.swap: def of ezmcp@0.1.0.0 Import: import ezmcp@0.1.0.0/src/openapi.bend as Openapi Lines 1128-1135 of ezmcp@0.1.0.0/src/openapi.bend: https://jend.leeeet.dev/read.txt?path=ezmcp@0.1.0.0/src/openapi.bend&start_line=1128&end_line=1135 import Base # a string with its first `pat` replaced by `rep` def swap(text: String, +pat: String, +rep: String) -> String: match text: case SNil{}: SNil{} case SCon{+ch, +rest}: swap.at(String.starts_with(SCon{ch, rest}, pat), SCon{ch, rest}, pat, rep, _u => SCon{ch, swap(rest, pat, rep)}) Uses (3): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.starts_with https://jend.leeeet.dev/definition.txt?path=ezmcp@0.1.0.0/src/openapi.bend&name=swap.at