Compose.co.alias: def of yaml-for-bend@0.1.1.0 Import: import yaml-for-bend@0.1.1.0/compose.bend as Compose Lines 493-502 of yaml-for-bend@0.1.1.0/compose.bend: https://jend.leeeet.dev/read.txt?path=yaml-for-bend@0.1.1.0/compose.bend&start_line=493&end_line=502 import Base import yaml-for-bend@0.1.1.0/token.bend as T import yaml-for-bend@0.1.1.0/value.bend as V # An alias: a copy of its node, counted at the node's full size. An alias # inside the node it names would make a cycle, which a tree can't hold. def co.alias(co: Co, +name: String, +limit: Nat, +at: T.Mark) -> Result<&2, &2, T.Error, Co>: match co: case Co{+stack, +anchors, count, root, docs, opened, depth, copied}: when(Result<&2, &2, T.Error, Co>, opens(stack, name), u => Fail{content("found an alias to a node that holds it: " ++ name ++ " is recursive, and a tree can't hold a cycle", at)}, u => when(Result<&2, &2, T.Error, Co>, Bool.not(found(Map.has(&2, Anchored, anchors, name))), u => Fail{content("found an alias to an unknown anchor: " ++ name, at)}, u => alias.got(Map.get(Anchored, Anchored{V.Null{}, 0n}, anchors, name), Co{stack, anchors, count, root, docs, opened, depth, copied}, limit, at))) Uses (17): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.not https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Map.get https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Map.has https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.append https://jend.leeeet.dev/definition.txt?path=yaml-for-bend@0.1.1.0/compose.bend&name=Anchored https://jend.leeeet.dev/definition.txt?path=yaml-for-bend@0.1.1.0/compose.bend&name=Co https://jend.leeeet.dev/definition.txt?path=yaml-for-bend@0.1.1.0/compose.bend&name=alias.got https://jend.leeeet.dev/definition.txt?path=yaml-for-bend@0.1.1.0/compose.bend&name=content https://jend.leeeet.dev/definition.txt?path=yaml-for-bend@0.1.1.0/compose.bend&name=found https://jend.leeeet.dev/definition.txt?path=yaml-for-bend@0.1.1.0/compose.bend&name=opens https://jend.leeeet.dev/definition.txt?path=yaml-for-bend@0.1.1.0/compose.bend&name=when https://jend.leeeet.dev/definition.txt?path=yaml-for-bend@0.1.1.0/token.bend&name=Error https://jend.leeeet.dev/definition.txt?path=yaml-for-bend@0.1.1.0/token.bend&name=Mark https://jend.leeeet.dev/definition.txt?path=yaml-for-bend@0.1.1.0/value.bend&name=Yaml