def list_take_pad
import unified-nsga-iii@0.2.2.0/util.bend as Utilimport Base
10# |take(xs ++ replicate(n, fill), n)| = n. Identity when |xs| = n
11# (take never reads the pad). Used to lock Run / select to the law size.
12def list_take_pad(-A: Data, +fill: A, xs: List<&2, A>, +n: Nat) -> List<&2, A>:
13 List.take(&2, A, List.append(&2, A, xs, List.replicate(A, n, fill)), n)