def table
import bend-lint-api@0.2.0.0/shared/names.bend as Namesimport Base
22# Each of `xs` with the name `show` gives it: a table for `lookup`, so that each name is written once, in `show`.
23def table(~A: Data, ~show: A -> String, xs: List<&2, A>) -> List<&2, Named<A>>:
24 match xs:
25 case Nil{}:
26 []
27 case Con{+x, rest}:
28 Named{show(x), x} <> table(~A, ~show, rest)