def insert_bag
import unified-nsga-iii@0.2.2.0/survival.bend as Survivalimport 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))