def Entries.unique

bend-trace-context@0.2.0.0 · trace_context.bend:1913

import bend-trace-context@0.2.0.0/trace_context.bend as TraceContext
import Base

1913# No entry repeats the key of an entry before it; `seen` holds the entries
1914# already passed. This is the order in which the reading machine checks keys.
1915def Entries.unique(entries: List<&2, StateEntry>, +seen: List<&2, StateEntry>) -> Bool:
1916  match entries:
1917    case Nil{}:
1918      True{}
1919    case Con{+entry, rest}:
1920      Bool.and(Bool.not(Entries.has_key(seen, StateEntry.key_text(entry))),
1921        Entries.unique(rest, List.append(&2, StateEntry, seen, Con{entry, Nil{}})))

Uses (8)

Used by (1)