def uniq_nats.go

unified-nsga-iii@0.2.2.0 · survival.bend:401

import unified-nsga-iii@0.2.2.0/survival.bend as Survival
import Base
import unified-nsga-iii@0.2.2.0/util.bend as Util

401# First-occurrence unique (C# HashSet of refs-with-candidates).
402def uniq_nats.go(xs: List<&2, Nat>, +acc: List<&2, Nat>) -> List<&2, Nat>:
403  match xs:
404    case Nil{}:
405      List.reverse(&2, Nat, acc)
406    case +h <> t:
407      uniq_nats.go(t, cons_if(h, acc, Bool.not(Util.in_nats(h, acc))))

Uses (6)

Used by (1)