def lookup.go

bend-lint-api@0.2.0.0 · shared/names.bend:8

import bend-lint-api@0.2.0.0/shared/names.bend as Names
import Base
import bend-lint-api@0.2.0.0/shared/lists.bend as Lists

8def lookup.go(
9  -A: Data,
10  +key: String,
11  table: List<&2, Named<A>>,
12  found: Maybe<&2, A>
13) -> Maybe<&2, A>:
14  match table found:
15    case _ Some{v}:
16      Some{v}
17    case Nil{} None{}:
18      None{}
19    case Con{Named{k, v}, rest} None{}:
20      lookup.go(A, key, rest, Lists.when(A, String.eq(k, key), v))

Uses (6)

Used by (1)