Zulip Chat Archive

Stream: new members

Topic: standard Map Types


Simon Daniel (Feb 23 2024 at 10:17):

i was wondering if there is a built in type like Lean.AssocList where keys are unique. I know about HashMaps/RBMap, but those seem to more for performance optimizing.
if not would this be a sensible implementation?

def uniqueAssocList (a b: Type) [BEq a]:=
    {l: Lean.AssocList a b //  (k:a), l.contains k -> ! (l.erase k).contains k}

Ruben Van de Velde (Feb 23 2024 at 10:46):

Hmm, I might have written it as something like "length of filter (equal to k) \le 1", but probably this works too

Mario Carneiro (Feb 23 2024 at 11:03):

docs#AList IIRC


Last updated: May 02 2025 at 03:31 UTC