<p>I work with a bunch of sets in order to generate constrained random traffic, but I want to be able to call a Specman macro that computes the complement of a set with syntax like:</p>

<pre><code>COMPLEMENT begin 
   domain=[0..10,24..30],
   complementing_set=[2..3,27..30] 
end
</code></pre>

<p>and have it generate:</p>

<pre><code>[0..1,4..10,24..26]
</code></pre>

<p>Every time I need the complement of a set I'm using fully populated lists (e.g. {0;1;2;3....} ) and then removing elements, instead of using Specman's built-in int_range_list object.  And I'm also doing a lot of these set calculations at run-time instead of compile-time.</p>

You can try this:
```
```
var domain: list of int = {0..10, 24..30}; 
var complementing_set: list of int = {2..3, 27..30};
var complement: list of int = domain.all(it in complementing set);
```
```
The
```
all
```
pseudo-method generates a sublist of the parent list of all the elements in the parent list for which the condition in the parentheses holds.