def search.lone

bolt@1.27.0.0 · src/rules/correctness/pick.bend:201

import bolt@1.27.0.0/src/rules/correctness/pick.bend as Pick
import Base
import bolt@1.27.0.0/src/syntax/lex.bend as Lex
import bolt@1.27.0.0/src/syntax/tree.bend as Tree

201# is the chain the one name xx alone?
202def search.lone(nn: Tree.Node, +xx: String) -> Bool:
203  match nn:
204    case Tree.NCons{Tree.Leaf{Lex.Tok{_k, +t, _l, _c}}, rest}:
205      Bool.and(String.eq(t, xx), search.empty(rest))
206    case _other:
207      False{}

Uses (7)

Used by (1)