def nth_comp.go
unified-nsga-iii@0.2.2.0 · reference_directions.bend:70
import unified-nsga-iii@0.2.2.0/reference_directions.bend as ReferenceDirections
import Base
70@unsafe def nth_comp.go(
71 ready: Bool,
72 take: Bool,
73 fuel: Nat,
74 +m: Nat,
75 +p: Nat,
76 +k: Nat,
77 +i: Nat,
78 left: Nat,
79 c: Nat
80) -> List<&2, Nat>:
81 match ready take fuel:
82 case True{} True{} f:
83 i <> nth_comp.go(False{}, False{}, f, m, left, k, 0n, 0n, 0n)
84 case True{} False{} f:
85 nth_comp.go(False{}, False{}, f, 1n+m, p, Nat.sub(k, c), 1n+i, 0n, 0n)
86 case False{} t 0n:
87 nth_comp.fallback(m, p)
88 case False{} t 1n+f:
89 match m:
90 case 0n:
91 Nil{}
92 case 1n:
93 [p]
94 case 1n+rd:
95 +left2 = Nat.sub(p, i)
96 +c2 = count(rd, left2)
97 nth_comp.go(True{}, Nat.is_lt(k, c2), f, rd, p, k, i, left2, c2)