- bag-sum bag1 bag2 ...procedure
- bag-sum! bag1 bag2procedure
The bag-sum procedure returns a newly allocated bag containing all the unique elements in all the bags, such that the count of each unique element in the result is equal to the sum of the counts of that element in the arguments. It differs from bag-union by treating identical elements as potentially distinct rather than attempting to match them up.
The bag-sum! procedure is equivalent except that it is linear-update.