chapel-lang/chapel — pull request #226 by benharsh (2014-08-26 20:55:15+00:00)
Title: Set operations for associative domains and arrays

This patch provides standard set operations on associative domains and arrays:
union : \+ or |
difference : \-
intersection : &
symmetric difference : ^

The op= variations are also supported for each operation.

Also provided is a 'subset' function for associative domains.

While much of this is new functionality, a significant difference this patch implements is that operations like '+' on associative arrays are no longer promoted. For example:

// before
var r = assocA + assocB; // r is a default rectangular array of A and B's values.

// after
var r = assocA + assocB; // r is an associative array composed of the indices in both A and B.

The new functionality is much more useful in the context of adding two associative arrays together.