def insert_row.go
unified-nsga-iii@0.2.2.0 · survival.bend:1032
import unified-nsga-iii@0.2.2.0/survival.bend as Survival
import Base
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041def insert_row.go(fuel: Nat, phase: Nat, before: Bool, +x: CvRow, xs: List<&2, CvRow>, +h: CvRow) -> List<&2, CvRow>:
1042 match fuel phase before:
1043 case 0n p b:
1044 x <> xs
1045 case 1n+f 0n b:
1046 match xs:
1047 case Nil{}:
1048 x <> Nil{}
1049 case +head <> tail:
1050 insert_row.go(f, 1n, row_before(x, head), x, tail, head)
1051 case 1n+f 1n+ph True{}:
1052 x <> h <> xs
1053 case 1n+f 1n+ph False{}:
1054 h <> insert_row.go(f, 0n, False{}, x, xs, h)