Grouped totals with a Dict
Julia
orders = [
(customer = "alice", cents = 1200),
(customer = "bob", cents = 800),
(customer = "alice", cents = 300),
]
totals = Dict{String,Int}()
for order in orders
totals[order.customer] = get(totals, order.customer, 0) + order.cents
end
for (customer, cents) in sort(collect(totals))
println("$customer: $cents")
end