def Entries.add.if
import bend-trace-context@0.2.0.0/trace_context.bend as TraceContextimport Base
2156# Keep the entries unchanged when the key was present; otherwise add the
2157# entry at the end.
2158def Entries.add.if(entries: List<&2, StateEntry>, entry: StateEntry, present: Bool) -> List<&2, StateEntry>:
2159 match present:
2160 case True{}:
2161 entries
2162 case False{}:
2163 List.append(&2, StateEntry, entries, Con{entry, Nil{}})