How can I sum an ArrayExpression?

The concordance method is super handy, but I want the discordance rate per sample. How can I sum the entries of the concordance table in each row of the sample results? Most things I’ve tried result in
<ArrayExpression of type array<array>> object is not iterable

I think the way to do this is probably something like:

all_indices = hl.flat_map(lambda i: hl.range(5).map(lambda j: (i, j)), hl.range(5))
discordant_indices = all_indices.filter(lambda elt: elt[0] != elt[1])
ht = ht.annotate(concordance_ratio = hl.sum(discordant_indices.map(lambda elt: ht.concordance[elt[0]][elt[1]]) / hl.sum(hl.range(5).map(lambda i: ht.concordance[i][i]))

Awesome, you saved me a LOT of time – thanks!!!