Core.key_once_at: def of bend-schema-lib@0.4.1.0 Import: import bend-schema-lib@0.4.1.0/core.bend as Core Lines 451-464 of bend-schema-lib@0.4.1.0/core.bend: https://jend.leeeet.dev/read.txt?path=bend-schema-lib@0.4.1.0/core.bend&start_line=451&end_line=464 import Base # name appears at most once among the keys of the object r. b is whether a key # read before r was already name; the flag carries forward, and a key that is # name while the flag is set is the second one -- refused here and nowhere # else. The value is the first argument because a self-call must read its # arguments left to right, unchanged until one shrinks, and only the value # shrinks; the value is matched first because a match cannot be nested inside # the branch of a match on another parameter. One pass, so a walk costs one # key per key, the same as the lookup beside it. def key_once_at(r: Raw, +b: Bool, +name: String) -> Bool: match r: case RKey{+k, +v, +o}: Bool.and(Bool.not(Bool.and(b, String.eq(k, name))), key_once_at(o, Bool.or(b, String.eq(k, name)), name)) case _: True{} Uses (7): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.not https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.or https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.eq https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=Raw