Cli.word_rest: def of cli@0.2.0.0 Import: import cli@0.2.0.0/cli.bend as Cli Lines 4792-4803 of cli@0.2.0.0/cli.bend: https://jend.leeeet.dev/read.txt?path=cli@0.2.0.0/cli.bend&start_line=4792&end_line=4803 import Base # Some{None{}} when text is the word name, Some{Some{rest}} when it is name, # a space and rest, None{} otherwise. Words are cut at spaces, so a name with # a space (Chr{32}) is no word. def word_rest(name: String, text: String, same: Bool) -> Maybe<&2, Maybe<&2, String>>: match name text same: case _ _ False{}: None{} case SNil{} SNil{} True{}: Some{None{}} case SNil{} SCon{Chr{32}, rest} True{}: Some{Some{rest}} case SCon{Chr{32}, xs} _ True{}: None{} case SCon{x, xs} SCon{y, ys} True{}: word_rest(xs, ys, Char.is_eq(x, y)) case _ _ _: None{} Uses (8): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Char https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Char.is_eq https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Word.Con https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Word.Nil