def sum_pos

unified-nsga-iii@0.2.2.0 · individual.bend:29

import unified-nsga-iii@0.2.2.0/individual.bend as Individual
import Base

29# Sum of g_i where g_i > 0. Non-positive parts add nothing.
30def sum_pos(xs: List<&2, F32>) -> F32:
31  match xs:
32    case Nil{}:
33      0.0
34    case +h <> t:
35      F32.add(pos_part(h), sum_pos(t))

Uses (4)

Used by (1)