def insert_bag

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

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

891def insert_bag(acc: List<&2, Bag>, +b: Bag, before: Bool) -> List<&2, Bag>:
892  match acc before:
893    case Nil{} p:
894      [b]
895    case +h <> t True{}:
896      b <> {h <> t : List<&2, Bag>}
897    case +h <> +t False{}:
898      h <> insert_bag(t, b, insert_before(t, b))

Uses (4)

Used by (1)